std::vector
structures.It conforms to the Digraph concept and it also provides several useful additional functionalities. Most of the member functions and nested classes are documented only in the concept class.
#include <lemon/list_graph.h>
Inherits DigraphExtender< ListDigraphBase >.
Classes | |
class | Snapshot |
Class to make a snapshot of the digraph and restore it later. More... | |
Public Member Functions | |
ListDigraph () | |
Node | addNode () |
Add a new node to the digraph. | |
Arc | addArc (const Node &s, const Node &t) |
Add a new arc to the digraph. | |
void | erase (const Node &n) |
void | erase (const Arc &a) |
bool | valid (Node n) const |
Node validity check. | |
bool | valid (Arc a) const |
Arc validity check. | |
void | changeTarget (Arc a, Node n) |
Change the target of a to n . | |
void | changeSource (Arc a, Node n) |
Change the source of a to n . | |
void | reverseArc (Arc e) |
Invert the direction of an arc. | |
void | reserveNode (int n) |
Reserve memory for nodes. | |
void | reserveArc (int m) |
Reserve memory for arcs. | |
void | contract (Node a, Node b, bool r=true) |
Contract two nodes. | |
Node | split (Node n, bool connect=true) |
Split a node. | |
Node | split (Arc e) |
Split an arc. | |
Private Member Functions | |
ListDigraph (const ListDigraph &) | |
void | operator= (const ListDigraph &) |
ListDigraph | ( | const ListDigraph & | ) | [inline, private] |
ListDigraph is not copy constructible. Use copyDigraph() instead.
ListDigraph | ( | ) | [inline] |
Constructor.
void operator= | ( | const ListDigraph & | ) | [inline, private] |
Assignment of ListDigraph to another one is not allowed. Use copyDigraph() instead.
Node addNode | ( | ) | [inline] |
Add a new node to the digraph.
Arc addArc | ( | const Node & | s, | |
const Node & | t | |||
) | [inline] |
Add a new arc to the digraph with source node s
and target node t
.
void erase | ( | const Node & | n | ) | [inline] |
Erase a node from the digraph.
void erase | ( | const Arc & | a | ) | [inline] |
Erase an arc from the digraph.
bool valid | ( | Node | n | ) | const [inline] |
This function gives back true if the given node is valid, ie. it is a real node of the graph.
bool valid | ( | Arc | a | ) | const [inline] |
This function gives back true if the given arc is valid, ie. it is a real arc of the graph.
void changeTarget | ( | Arc | a, | |
Node | n | |||
) | [inline] |
Change the target of a
to n
ArcIt
s and OutArcIt
s referencing the changed arc remain valid. However InArcIt
s are invalidated.void changeSource | ( | Arc | a, | |
Node | n | |||
) | [inline] |
Change the source of a
to n
InArcIt
s referencing the changed arc remain valid. However the ArcIt
s and OutArcIt
s are invalidated.void reverseArc | ( | Arc | e | ) | [inline] |
ArcIt
s referencing the changed arc remain valid. However OutArcIt
s and InArcIt
s are invalidated.void reserveNode | ( | int | n | ) | [inline] |
Using this function it is possible to avoid the superfluous memory allocation: if you know that the digraph you want to build will be very large (e.g. it will contain millions of nodes and/or arcs) then it is worth reserving space for this amount before starting to build the digraph.
void reserveArc | ( | int | m | ) | [inline] |
Using this function it is possible to avoid the superfluous memory allocation: if you know that the digraph you want to build will be very large (e.g. it will contain millions of nodes and/or arcs) then it is worth reserving space for this amount before starting to build the digraph.
void contract | ( | Node | a, | |
Node | b, | |||
bool | r = true | |||
) | [inline] |
This function contracts two nodes. Node b
will be removed but instead of deleting incident arcs, they will be joined to a
. The last parameter r
controls whether to remove loops. true
means that loops will be removed.
ArcIt
s referencing a moved arc remain valid. However InArcIt
s and OutArcIt
s may be invalidated.Node split | ( | Node | n, | |
bool | connect = true | |||
) | [inline] |
This function splits a node. First a new node is added to the digraph, then the source of each outgoing arc of n
is moved to this new node. If connect
is true
(this is the default value), then a new arc from n
to the newly created node is also added.
ArcIt
s referencing a moved arc remain valid. However InArcIt
s and OutArcIt
s may be invalidated.Node split | ( | Arc | e | ) | [inline] |
This function splits an arc. First a new node b
is added to the digraph, then the original arc is re-targeted to b
. Finally an arc from b
to the original target is added.