GridUGraph Class Reference
[Graph Structures]


Detailed Description

This class implements a special graph type. The nodes of the graph can be indiced by two integer (i,j) value where i is in the [0,width) range and j is in the [0, height) range. Two nodes are connected in the graph if the indices differ only on one position and only one is the difference.

grid_ugraph.png

The graph can be indiced in the following way:

      GridUGraph graph(w, h);
      GridUGraph::NodeMap<int> val(graph); 
      for (int i = 0; i < graph.width(); ++i) {
        for (int j = 0; j < graph.height(); ++j) {
          val[graph(i, j)] = i + j;
        }
      }

The graph type is fully conform to the Undirected Graph concept, and it also has an important extra feature that its maps are real reference maps.

Author:
Balazs Dezso
#include <lemon/grid_ugraph.h>

Inheritance diagram for GridUGraph:

Inheritance graph
[legend]

List of all members.

Classes

class  ColMap
class  IndexMap
class  RowMap

Public Member Functions

 GridUGraph (int n, int m)
 Constructor.
void resize (int n, int m)
 Resize the graph.
Node operator() (int i, int j) const
 The node on the given position.
int row (Node n) const
int col (Node n) const
int width () const
int height () const
Edge down (Node n) const
 Gives back the edge goes down from the node.
Edge up (Node n) const
 Gives back the edge goes up from the node.
Edge right (Node n) const
 Gives back the edge goes right from the node.
Edge left (Node n) const
 Gives back the edge goes left from the node.


Constructor & Destructor Documentation

GridUGraph ( int  n,
int  m 
) [inline]


Member Function Documentation

Node operator() ( int  i,
int  j 
) const [inline]

Gives back the node on the given position.

int row ( Node  n  )  const [inline]

Gives back the row index of the node.

int col ( Node  n  )  const [inline]

Gives back the coloumn index of the node.

int width (  )  const [inline]

Gives back the width of the graph.

int height (  )  const [inline]

Gives back the height of the graph.

Edge down ( Node  n  )  const [inline]

Gives back the edge goes down from the node. If there is not outgoing edge then it gives back INVALID.

Edge up ( Node  n  )  const [inline]

Gives back the edge goes up from the node. If there is not outgoing edge then it gives back INVALID.

Edge right ( Node  n  )  const [inline]

Gives back the edge goes right from the node. If there is not outgoing edge then it gives back INVALID.

Edge left ( Node  n  )  const [inline]

Gives back the edge goes left from the node. If there is not outgoing edge then it gives back INVALID.


Generated on Thu Jun 4 04:04:53 2009 for LEMON by  doxygen 1.5.9