Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

General Graph Utilities
[Graph Algorithms]


Detailed Description


Files

file  graph_utils.h
 Graph utilities.

Classes

class  ConEdgeIt
 Iterator for iterating on edges connected the same nodes. More...
class  GraphCopy
 Class to copy a graph. More...

Functions

template<typename Graph, typename ItemIt>
int lemon::countItems (const Graph &g)
 Function to count the items in the graph.
template<typename Graph>
int lemon::countNodes (const Graph &g)
 Function to count the nodes in the graph.
template<typename Graph>
int lemon::countEdges (const Graph &g)
 Function to count the edges in the graph.
template<typename Graph>
int lemon::countUndirEdges (const Graph &g)
 Function to count the undirected edges in the graph.
template<typename Graph>
int lemon::countOutEdges (const Graph &_g, const typename Graph::Node &_n)
 Function to count the number of the out-edges from node n.
template<typename Graph>
int lemon::countInEdges (const Graph &_g, const typename Graph::Node &_n)
 Function to count the number of the in-edges to node n.
template<typename Graph>
Graph::Edge lemon::findEdge (const Graph &g, typename Graph::Node u, typename Graph::Node v, typename Graph::Edge prev=INVALID)
 Finds an edge between two nodes of a graph.
template<typename Target, typename Source, typename ItemIt, typename Ref>
void lemon::copyMap (Target &target, const Source &source, ItemIt it, const Ref &ref)
 Copy a map.
template<typename Target, typename Source, typename ItemIt>
void lemon::copyMap (Target &target, const Source &source, ItemIt it)
 Copy the source map to the target map.
template<typename Target, typename Source>
GraphCopy< Target, Source > lemon::copyGraph (Target &target, const Source &source)
 Copy a graph to an other graph.


Function Documentation

int lemon::countItems const Graph &  g  )  [inline]
 

This function counts the items (nodes, edges etc) in the graph. The complexity of the function is O(n) because it iterates on all of the items.

int lemon::countNodes const Graph &  g  )  [inline]
 

This function counts the nodes in the graph. The complexity of the function is O(n) but for some graph structures it is specialized to run in O(1).

Todo:
refer how to specialize it

int lemon::countEdges const Graph &  g  )  [inline]
 

This function counts the edges in the graph. The complexity of the function is O(e) but for some graph structures it is specialized to run in O(1).

int lemon::countUndirEdges const Graph &  g  )  [inline]
 

This function counts the undirected edges in the graph. The complexity of the function is O(e) but for some graph structures it is specialized to run in O(1).

int lemon::countOutEdges const Graph &  _g,
const typename Graph::Node &  _n
[inline]
 

This function counts the number of the out-edges from node n in the graph.

int lemon::countInEdges const Graph &  _g,
const typename Graph::Node &  _n
[inline]
 

This function counts the number of the in-edges to node n in the graph.

Graph::Edge lemon::findEdge const Graph &  g,
typename Graph::Node  u,
typename Graph::Node  v,
typename Graph::Edge  prev = INVALID
[inline]
 

Finds an edge from node u to node v in graph g.

If prev is INVALID (this is the default value), then it finds the first edge from u to v. Otherwise it looks for the next edge from u to v after prev.

Returns:
The found edge or INVALID if there is no such an edge.
Thus you can iterate through each edge from u to v as it follows.
      for(Edge e=findEdge(g,u,v);e!=INVALID;e=findEdge(g,u,v,e)) {
        ...
      }

void lemon::copyMap Target &  target,
const Source &  source,
ItemIt  it,
const Ref &  ref
 

This function copies the source map to the target map. It uses the given iterator to iterate on the data structure and it uses the ref mapping to convert the source's keys to the target's keys.

void lemon::copyMap Target &  target,
const Source &  source,
ItemIt  it
 

Copy the source map to the target map. It uses the given iterator to iterate on the data structure.

GraphCopy<Target, Source> lemon::copyGraph Target &  target,
const Source &  source
 

Copy a graph to an other graph. The usage of the function:

      copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr);

After the copy the nr map will contain the mapping from the source graph's nodes to the target graph's nodes and the ecr will contain the mapping from the target graph's edges to the source's edges.


Generated on Sat Aug 27 14:14:56 2005 for LEMON by  doxygen 1.4.4