This is a simple and fast directed full graph implementation. From each node go arcs to each node (including the source node), therefore the number of the arcs in the digraph is the square of the node number. This digraph type is completely static, so you can neither add nor delete either arcs or nodes, and it needs constant space in memory.
This class fully conforms to the Digraph concept.
The FullDigraph
and FullGraph
classes are very similar, but there are two differences. While this class conforms only to the Digraph concept, the FullGraph
class conforms to the Graph concept, moreover FullGraph
does not contain a loop arc for each node as FullDigraph
does.
#include <lemon/full_graph.h>
Inherits lemon::DigraphExtender< FullDigraphBase >.
Public Member Functions | |
FullDigraph () | |
Constructor. | |
FullDigraph (int n) | |
Constructor. | |
void | resize (int n) |
Resizes the digraph. | |
Node | operator() (int ix) const |
Returns the node with the given index. | |
int | index (const Node &node) const |
Returns the index of the given node. | |
Arc | arc (const Node &u, const Node &v) const |
int | nodeNum () const |
Number of nodes. | |
int | arcNum () const |
Number of arcs. |
FullDigraph | ( | int | n | ) | [inline] |
Constructor.
n | The number of the nodes. |
void resize | ( | int | n | ) | [inline] |
Resizes the digraph. The function will fully destroy and rebuild the digraph. This cause that the maps of the digraph will reallocated automatically and the previous values will be lost.
Node operator() | ( | int | ix | ) | const [inline] |
int index | ( | const Node & | node | ) | const [inline] |
Returns the index of the given node. Since it is a static digraph its nodes can be indexed with integers from the range [0..nodeNum()-1]
.
Arc arc | ( | const Node & | u, |
const Node & | v | ||
) | const [inline] |
Returns the arc connecting the given nodes.