Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

def_graph.hpp File Reference


Detailed Description

Definitions, mainly related to boost.

Author:
Wolfram Koska

$Id$

Here, definitions for the Boost Graph Library and mappings from the BGL to our interface are defined.

When using another graph library as boost as a foundation for this graph library, this is the main place for changes.

#include <string>
#include <map>
#include "boost/graph/adjacency_list.hpp"
#include "Property.hpp"

Include dependency graph for def_graph.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  gns

Defines

#define DEBUG   1
 Set to 1 if debugging, comment out if not debugging.
#define foreach_node(G, n)   for(gns::NodeIter __next = (G)->first_node(), (n) = __next++; (n) != (G)->last_node(); (n) = __next, ++__next)
 Loop through each node of the graph. Inside the loop, n is a NodeIter.
#define foreach_edge(G, e)   for(gns::EdgeIter __next = (G)->first_edge(), (e) = __next++; (e) != (G)->last_edge(); (e) = __next, ++__next)
 Loop through each edge of the graph. Inside the loop, e is an EdgeIter.
#define foreach_in_edge(G, n, e)   for(gns::InEdgeIter __next = (G)->first_in_edge(n), (e) = __next++; (e) != (G)->last_in_edge(n); (e) = __next, ++__next)
 Loop through each incoming edge of the node. Inside the loop, e is an EdgeIter.
#define foreach_out_edge(G, n, e)   for(gns::OutEdgeIter __next = (G)->first_out_edge(n), (e) = __next++; (e) != (G)->last_out_edge(n); (e) = __next, ++__next)
 Loop through each outgoing edge of the node. Inside the loop, e is an EdgeIter.

Typedefs

typedef boost::adjacency_list<
boost::listS, boost::listS,
boost::bidirectionalS, boost::no_property,
boost::no_property, boost::no_property,
boost::listS > 
Graph_t
 The boost graph type.
typedef std::string NodeID
 NodeID declared as std::string.
typedef std::string EdgeID
 EdgeID declared as std::string.
typedef boost::graph_traits<
Graph_t >::vertex_descriptor 
Node
 Typedef for boost: Node descriptor.
typedef boost::graph_traits<
Graph_t >::edge_descriptor 
Edge
 Typedef for boost: Edge descriptor.
typedef boost::graph_traits<
Graph_t >::vertex_iterator 
NodeIter
 Typedef for boost: node iterator.
typedef boost::graph_traits<
Graph_t >::edge_iterator 
EdgeIter
 Typedef for boost: edge iterator.
typedef boost::graph_traits<
Graph_t >::out_edge_iterator 
OutEdgeIter
 Typedef for boost: outgoing edge iterator.
typedef boost::graph_traits<
Graph_t >::in_edge_iterator 
InEdgeIter
 Typedef for boost: incoming edge iterator.


Define Documentation

#define DEBUG   1
 

Set to 1 if debugging, comment out if not debugging.

#define foreach_edge G,
 )     for(gns::EdgeIter __next = (G)->first_edge(), (e) = __next++; (e) != (G)->last_edge(); (e) = __next, ++__next)
 

Loop through each edge of the graph. Inside the loop, e is an EdgeIter.

See foreach_node().

#define foreach_in_edge G,
n,
 )     for(gns::InEdgeIter __next = (G)->first_in_edge(n), (e) = __next++; (e) != (G)->last_in_edge(n); (e) = __next, ++__next)
 

Loop through each incoming edge of the node. Inside the loop, e is an EdgeIter.

See foreach_node().

As there is no means of looping through the in- and outgoing edges of a node in boost, no makro for this functionality exists.

#define foreach_node G,
 )     for(gns::NodeIter __next = (G)->first_node(), (n) = __next++; (n) != (G)->last_node(); (n) = __next, ++__next)
 

Loop through each node of the graph. Inside the loop, n is a NodeIter.

This is a makro defining a for loop and thus can be used just like one. n is created in the loop, if it had a value outside the loop, this will not be accessible.
is a NodeIter pointing to the actual element in the loop. Note that deleting the node pointed to by n is a valid operation and does not influence the continued loop execution (see Internals).

Example:

 // g is a Graph*, p is a PropertyFacility*
 foreach_node(g, n)
 {
   p->set<int>(*n, "number", 1);
   p->set<double>(*n, "weight", 0.2);
 }

 foreach_node(g, n)
   std::cout << g->node_id(*n) << std::endl;

Internals
Inside the loop, __next is an iterator pointing to the next element and should not be used. This enables the user to even delete the node pointed to by n without compromising the continued execution of the loop.

#define foreach_out_edge G,
n,
 )     for(gns::OutEdgeIter __next = (G)->first_out_edge(n), (e) = __next++; (e) != (G)->last_out_edge(n); (e) = __next, ++__next)
 

Loop through each outgoing edge of the node. Inside the loop, e is an EdgeIter.

See foreach_node().

As there is no means of looping through the in- and outgoing edges of a node in boost, no makro for this functionality exists.


Typedef Documentation

typedef boost::graph_traits<Graph_t>::edge_descriptor Edge
 

Typedef for boost: Edge descriptor.

typedef std::string EdgeID
 

EdgeID declared as std::string.

typedef boost::graph_traits<Graph_t>::edge_iterator EdgeIter
 

Typedef for boost: edge iterator.

typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::no_property, boost::no_property, boost::no_property, boost::listS > Graph_t
 

The boost graph type.

typedef boost::graph_traits<Graph_t>::in_edge_iterator InEdgeIter
 

Typedef for boost: incoming edge iterator.

typedef boost::graph_traits<Graph_t>::vertex_descriptor Node
 

Typedef for boost: Node descriptor.

typedef std::string NodeID
 

NodeID declared as std::string.

typedef boost::graph_traits<Graph_t>::vertex_iterator NodeIter
 

Typedef for boost: node iterator.

typedef boost::graph_traits<Graph_t>::out_edge_iterator OutEdgeIter
 

Typedef for boost: outgoing edge iterator.


Generated on Sun Nov 5 12:05:29 2006 for Graph by  doxygen 1.4.1