FullDigraph is a simple and fast implmenetation of directed full (complete) graphs. It contains an arc from each node to each node (including a loop for each node), therefore the number of arcs is the square of the number of nodes. This class is completely static and it needs constant memory space. Thus you can neither add nor delete nodes or arcs, however the structure can be resized using resize().
This type fully conforms to the Digraph concept. Most of its member functions and nested classes are documented only in the concept class.
This class provides constant time counting for nodes and arcs.
#include <lemon/full_graph.h>
Inherits lemon::DigraphExtender< FullDigraphBase >.
Public Member Functions | |
FullDigraph () | |
Default constructor. | |
FullDigraph (int n) | |
Constructor. | |
void | resize (int n) |
Resizes the digraph. | |
Node | operator() (int ix) const |
Returns the node with the given index. | |
Arc | arc (Node u, Node v) const |
int | nodeNum () const |
Number of nodes. | |
int | arcNum () const |
Number of arcs. | |
Static Public Member Functions | |
static int | index (const Node &node) |
Returns the index of the given node. |
FullDigraph | ( | ) | [inline] |
Default constructor. The number of nodes and arcs will be zero.
FullDigraph | ( | int | n | ) | [inline] |
Constructor.
n | The number of the nodes. |
void resize | ( | int | n | ) | [inline] |
This function resizes the digraph. It fully destroys and rebuilds the structure, therefore the maps of the digraph will be reallocated automatically and the previous values will be lost.
Node operator() | ( | int | ix | ) | const [inline] |
static int index | ( | const Node & | node | ) | [inline, static] |
Returns the index of the given node. Since this structure is completely static, the nodes can be indexed with integers from the range [0..nodeNum()-1]
. The index of a node is the same as its ID.
Arc arc | ( | Node | u, |
Node | v | ||
) | const [inline] |
Returns the arc connecting the given nodes.