|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Builds node and arc indices for fast lookup and retrieval. More...
#include <tpl_indexGraph.H>
Public Member Functions | |
| Index_Graph (GT &g) | |
| Creates an index of the graph: nodes and arcs are indexed. | |
| GT_Node * | insert_node (const GT_Node_Type &info) |
| Creates a new node and inserts it into the graph and the index. | |
| GT_Arc * | insert_arc (GT_Node *src, GT_Node *tgt, const GT_Arc_Type &info=GT_Arc_Type()) |
| Creates a new arc between two nodes and inserts it into the graph and the index. | |
| GT_Node * | search_node (GT_Node *p) |
| Looks up a node in the index. | |
| GT_Node * | search_node (const GT_Node_Type &info) |
| Looks up a node in the index. | |
| GT_Arc * | search_arc (GT_Node *src, GT_Node *tgt) |
| Looks up an arc in the index given its two nodes. | |
| void | remove_node (GT_Node *p) |
| Removes node p from the graph and from the index. | |
| void | remove_arc (GT_Arc *a) |
| Removes arc a from the graph and from the index. | |
| size_t | get_num_arcs () const |
| Returns the number of arcs the index contains. | |
| size_t | get_num_nodes () const |
| Returns the number of nodes the index contains. | |
Private Types | |
| typedef GT::Arc | GT_Arc |
| typedef GT::Node | GT_Node |
| typedef GT::Arc_Type | GT_Arc_Type |
| typedef GT::Node_Type | GT_Node_Type |
Private Attributes | |
| IndexNode< GT, Compare, Tree > | idx_node |
| IndexArc< GT, Tree > | idx_arc |
Builds node and arc indices for fast lookup and retrieval.
Index_Graph indexes nodes and arcs for the sake of their fast retrieval.
To make it easier and safer to use, Index_Graph offers the classic topological operations of a graph: insert_node(), insert_arc(), etc.
The class takes the following type parameters:
By default this class is programmed to compare the value returned by get_info() on each node. For that, the < operator of type GT::Node_Type must be implemented
Definition at line 118 of file tpl_indexGraph.H.
|
private |
Definition at line 122 of file tpl_indexGraph.H.
|
private |
Definition at line 124 of file tpl_indexGraph.H.
|
private |
Definition at line 123 of file tpl_indexGraph.H.
|
private |
Definition at line 125 of file tpl_indexGraph.H.
|
inline |
Creates an index of the graph: nodes and arcs are indexed.
Definition at line 133 of file tpl_indexGraph.H.
|
inline |
Returns the number of arcs the index contains.
Definition at line 229 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_arc.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Returns the number of nodes the index contains.
Definition at line 232 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Creates a new arc between two nodes and inserts it into the graph and the index.
| [in] | src | source node. |
| [in] | tgt | target node. |
| [in] | info | information to be copied into the arc. By default it is whatever the GT_Arc_Type() constructor gives. |
| bad_alloc | if there is not enough memory. |
Definition at line 159 of file tpl_indexGraph.H.
References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::Index_Graph< GT, Compare, Tree >::idx_arc, and Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Creates a new node and inserts it into the graph and the index.
| [in] | info | information to be copied into the node. |
| bad_alloc | if there is not enough memory. |
Definition at line 144 of file tpl_indexGraph.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Removes arc a from the graph and from the index.
Definition at line 223 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_arc.
|
inline |
Removes node p from the graph and from the index.
| [in] | p | pointer to the node to remove |
Definition at line 212 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_arc, and Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Looks up an arc in the index given its two nodes.
| [in] | src | pointer to the source node. |
| [in] | tgt | pointer to the target node. |
Definition at line 203 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_arc.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Looks up a node in the index.
| [in] | info | information by which the node will be searched for. |
Definition at line 191 of file tpl_indexGraph.H.
References Aleph::blossom_maximum_cardinality_matching(), and Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
|
inline |
Looks up a node in the index.
| [in] | p | pointer to the node. |
Definition at line 177 of file tpl_indexGraph.H.
References Aleph::Index_Graph< GT, Compare, Tree >::idx_node.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Definition at line 128 of file tpl_indexGraph.H.
Referenced by Aleph::Index_Graph< GT, Compare, Tree >::get_num_arcs(), Aleph::Index_Graph< GT, Compare, Tree >::insert_arc(), Aleph::Index_Graph< GT, Compare, Tree >::remove_arc(), Aleph::Index_Graph< GT, Compare, Tree >::remove_node(), and Aleph::Index_Graph< GT, Compare, Tree >::search_arc().
Definition at line 127 of file tpl_indexGraph.H.
Referenced by Aleph::Index_Graph< GT, Compare, Tree >::get_num_nodes(), Aleph::Index_Graph< GT, Compare, Tree >::insert_arc(), Aleph::Index_Graph< GT, Compare, Tree >::insert_node(), Aleph::Index_Graph< GT, Compare, Tree >::remove_node(), Aleph::Index_Graph< GT, Compare, Tree >::search_node(), and Aleph::Index_Graph< GT, Compare, Tree >::search_node().