All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions
FullGraph Class Reference

Detailed Description

FullGraph is a simple and fast implmenetation of undirected full (complete) graphs. It contains an edge between every distinct pair of nodes, therefore the number of edges is n(n-1)/2. This class is completely static and it needs constant memory space. Thus you can neither add nor delete nodes or edges, however the structure can be resized using resize().

This type fully conforms to the Graph concept. Most of its member functions and nested classes are documented only in the concept class.

This class provides constant time counting for nodes, edges and arcs.

Note
FullDigraph and FullGraph classes are very similar, but there are two differences. While FullDigraph conforms only to the Digraph concept, this class conforms to the Graph concept, moreover this class does not contain a loop for each node as FullDigraph does.
See Also
FullDigraph

#include <lemon/full_graph.h>

Inherits GraphExtender< Base >.

Public Member Functions

 FullGraph ()
 Default constructor.
 
 FullGraph (int n)
 Constructor.
 
void resize (int n)
 Resizes the graph.
 
Node operator() (int ix) const
 Returns the node with the given index.
 
Arc arc (Node s, Node t) const
 
Edge edge (Node u, Node v) const
 
int nodeNum () const
 Number of nodes.
 
int arcNum () const
 Number of arcs.
 
int edgeNum () const
 Number of edges.
 

Static Public Member Functions

static int index (const Node &node)
 Returns the index of the given node.
 

Constructor & Destructor Documentation

FullGraph ( )
inline

Default constructor. The number of nodes and edges will be zero.

FullGraph ( int  n)
inline

Constructor.

Parameters
nThe number of the nodes.

Member Function Documentation

void resize ( int  n)
inline

This function resizes the graph. It fully destroys and rebuilds the structure, therefore the maps of the graph will be reallocated automatically and the previous values will be lost.

Node operator() ( int  ix) const
inline

Returns the node with the given index. 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.

See Also
index()
static int index ( const Node &  node)
inlinestatic

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.

See Also
operator()()
Arc arc ( Node  s,
Node  t 
) const
inline

Returns the arc connecting the given nodes.

Edge edge ( Node  u,
Node  v 
) const
inline

Returns the edge connecting the given nodes.