#include <ConstGraph.hpp>
Inheritance diagram for ConstGraph:
This Graph class uses a boost Graph for the underlying graph structure. The IDs of the nodes and edges can only be modified through the appropriate methods. All other properties can be stored in the PropertyFacility.
If a method does not specify the behaviour for invalid arguments (e.g. if an invalid node is passed to indeg(Node n) ) then the result is undefined. If you are unsure if the Node or Edge is valid and part of the graph, check with node_exists(Node n) or edge_exists(Edge e).
A first_edge(Node) and last_edge(Node) method does not exist because boost does not provide this functionality. Only *_in_edge and *_out_edge are supported.
Public Member Functions | |
ConstGraph () | |
Empty constructor. | |
ConstGraph (PropertyFacility *p) | |
Constructor. | |
ConstGraph (const ConstGraph &g) | |
Copy constructor. | |
virtual | ~ConstGraph () |
Destructor. | |
virtual bool | node_exists (Node n) const |
Checks if the node is valid and part of the graph. | |
virtual bool | node_exists (NodeID id) const |
Checks if there is a Node with a specific ID. | |
virtual Node | node (const NodeID id) const |
Returns the Node with the given ID. | |
virtual NodeID | node_id (const Node n) const |
Returns the ID of a node. | |
virtual void | node_id (Node n, const NodeID id) |
Set the ID of a node. | |
virtual bool | edge_exists (Edge e) const |
Checks if the edge is valid and part of the graph. | |
virtual bool | edge_exists (const EdgeID id) const |
8 Checks if there is an Edge with a specific ID. | |
virtual Edge | edge (const EdgeID id) const |
Returns the Edge with the given ID. | |
virtual Edge | edge (const Node u, const Node v) const |
Returns an Edge from Node u to Node v. | |
virtual EdgeID | edge_id (const Edge e) const |
Returns the ID of a node. | |
virtual void | edge_id (Edge e, const EdgeID id) |
Set the ID of an edge. | |
virtual void | print () const |
Print the graph to stdout. | |
long | num_nodes () const |
Returns the number of nodes in the graph. | |
long | num_edges () const |
Returns the number of edges in the graph. | |
long | indeg (const Node n) const |
Returns the number of incoming edges of a node. | |
long | outdeg (const Node n) const |
Returns the number of outgoing edges of a node. | |
Node | source (const Edge e) const |
Returns the source node of an edge. | |
Node | target (const Edge e) const |
Returns the target node of an edge. | |
Node | opposite (const Edge e, const Node n) const |
Returns the node of an edge opposite of the given node. | |
NodeIter | first_node () const |
Returns the iterator for the first node. | |
NodeIter | last_node () const |
Returns the iterator for the end of the nodes. | |
EdgeIter | first_edge () const |
Returns the iterator for the first edge. | |
EdgeIter | last_edge () const |
Returns the iterator for the end of the edges. | |
OutEdgeIter | first_out_edge (const Node n) const |
Returns the iterator for the first outgoing edge. | |
OutEdgeIter | last_out_edge (const Node n) const |
Returns the iterator for the last outgoing edge. | |
InEdgeIter | first_in_edge (const Node n) const |
Returns the iterator for the first incoming edge. | |
InEdgeIter | last_in_edge (const Node n) const |
Returns the iterator for the last incoming edge. | |
PropertyFacility * | properties () const |
Returns the property facility used by the graph. | |
bool | valid_node (Node n) const |
Checks if the node is valid. | |
bool | valid_edge (Edge e) const |
Checks if the edge is valid. | |
Protected Types | |
typedef std::hash_map< NodeID, Node > | id_node_map_t |
Type for NodeID->Node map. | |
typedef std::hash_map< EdgeID, Edge > | id_edge_map_t |
Type for EdgeID->Edge map. | |
typedef std::hash_map< Node, NodeID > | node_id_map_t |
Type for Node->NodeID map. | |
typedef std::hash_map< Edge, EdgeID > | edge_id_map_t |
Type for Edge->EdgeID map. | |
Protected Member Functions | |
virtual Node | priv_new_node (NodeID id="") |
Add a node to the graph. | |
virtual void | priv_del_node (Node n) |
Delete a node from the graph and removes all edges adjacent to this node. | |
virtual Edge | priv_new_edge (Node u, Node v, EdgeID id="") |
Add an edge to the graph. | |
virtual void | priv_del_edge (Edge e) |
Delete an edge from the graph. | |
virtual void | priv_del_edge (Node u, Node v) |
Delete a(ll) directed (u,v) edge(s) from the graph. | |
virtual void | priv_add_nodes (int num, int start) |
Convenient method to add nodes to the graph. | |
virtual std::map< Node, Node > * | init_copy (const ConstGraph *g, bool return_map) |
Init a graph by making a copy of another graph. | |
virtual void | init (PropertyFacility *p) |
Initializes Graph. | |
Protected Attributes | |
Graph_t * | graph |
Vertices: list, Edges: list, bidirectional. | |
PropertyFacility * | prop |
PropertyFacility of the Graph. | |
node_id_map_t | node_id_map |
Map mapping nodes to their node id. | |
id_node_map_t | id_node_map |
Map for getting nodes by NodeID. | |
edge_id_map_t | edge_id_map |
Map mapping edges to their edge id. | |
id_edge_map_t | id_edge_map |
Map for getting edges by EdgeID. |
|
Type for Edge->EdgeID map.
|
|
Type for EdgeID->Edge map.
|
|
Type for NodeID->Node map.
|
|
Type for Node->NodeID map.
|
|
Empty constructor.
|
|
Constructor.
|
|
Copy constructor.
|
|
Destructor.
|
|
Returns an Edge from Node u to Node v. Complexity:
If no edge exists from u to v, an invalid edge is returned (check via valid_edge()). If there are multiple edges between u and v, the first one found is returned.
|
|
Returns the Edge with the given ID. Complexity (see stl hash_map):
|
|
8 Checks if there is an Edge with a specific ID. Complexity (see stl hash_map):
|
|
Checks if the edge is valid and part of the graph. Complexity (see stl hash_map):
|
|
Set the ID of an edge. Complexity (see stl hash_map):
Reimplemented in Hierarchy, ObservableGraph, and View. |
|
Returns the ID of a node. Complexity (see stl hash_map):
|
|
Returns the iterator for the first edge. Complexity: Boost: Constant time |
|
Returns the iterator for the first incoming edge. Complexity: Boost: Constant time
|
|
Returns the iterator for the first node. Complexity: Boost: Constant time |
|
Returns the iterator for the first outgoing edge. Complexity: Boost: Constant time
|
|
Returns the number of incoming edges of a node. Complexity: Boost: O( #in_edges )
|
|
Initializes Graph.
|
|
Init a graph by making a copy of another graph.
|
|
Returns the iterator for the end of the edges. Complexity: Boost: Constant time |
|
Returns the iterator for the last incoming edge. Complexity: Boost: Constant time
|
|
Returns the iterator for the end of the nodes. Complexity: Boost: Constant time |
|
Returns the iterator for the last outgoing edge. Complexity: Boost: Constant time
|
|
Returns the Node with the given ID. Complexity (see stl hash_map):
|
|
Checks if there is a Node with a specific ID. Complexity (see stl hash_map):
|
|
Checks if the node is valid and part of the graph. Complexity (see stl hash_map):
|
|
Set the ID of a node. Complexity (see stl hash_map):
Reimplemented in Hierarchy, ObservableGraph, and View. |
|
Returns the ID of a node. Complexity (see stl hash_map):
|
|
Returns the number of edges in the graph.
|
|
Returns the number of nodes in the graph.
|
|
Returns the node of an edge opposite of the given node. Complexity: Boost: Constant time
|
|
Returns the number of outgoing edges of a node. Complexity: Boost: O( #out_edges )
|
|
Print the graph to stdout.
|
|
Convenient method to add nodes to the graph. Adds num nodes with IDs starting from start (e.g.: num == 2, start == 4: new nodes with ids "4" and "5"). Complexity: O( num * O(priv_add_node()) )
|
|
Delete a(ll) directed (u,v) edge(s) from the graph. This also deletes the properties of the edge(s). Complexity:
|
|
Delete an edge from the graph. This also deletes the properties of the edge. Complexity:
|
|
Delete a node from the graph and removes all edges adjacent to this node. This also deleted the properties of the node. Complexity:
|
|
Add an edge to the graph. Complexity (see stl hash_map):
|
|
Add a node to the graph. Complexity (see stl hash_map):
|
|
Returns the property facility used by the graph. Complexity: Constant time |
|
Returns the source node of an edge. Complexity: Boost: Constant time
|
|
Returns the target node of an edge. Complexity: Boost: Constant time
|
|
Checks if the edge is valid. Checks if the boost properties of an edge are NULL. Complexity: Constant time
|
|
Checks if the node is valid. Currently, checks for != NULL. Complexity: Constant time
|
|
Map mapping edges to their edge id.
|
|
Vertices: list, Edges: list, bidirectional.
|
|
Map for getting edges by EdgeID.
|
|
Map for getting nodes by NodeID.
|
|
Map mapping nodes to their node id.
|
|
PropertyFacility of the Graph.
|