|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Build a mapped subgraph from a graph starting at a given node. More...
#include <tpl_components.H>
Public Member Functions | |
| Build_Subgraph (SA arc_filter=SA()) | |
| Construct a subgraph builder with optional arc filter. | |
| void | operator() (const GT &g, GT &sg, typename GT::Node *g_src) |
| Build a mapped subgraph starting from a specific node. | |
| GT | operator() (const GT &g, typename GT::Node *src) |
| Build and return a subgraph containing all nodes reachable from src. | |
| void | operator() (const GT &g, DynList< typename GT::Node * > &list, typename GT::Node *src) |
| Build a list of all nodes reachable from a source node. | |
Private Member Functions | |
| void | build_subgraph (GT &sg, typename GT::Node *g_src) |
| template<template< class > class List> | |
| void | build_subgraph (List< typename GT::Node * > &l, typename GT::Node *p) |
Private Attributes | |
| SA | sa |
| const GT * | gptr = nullptr |
| size_t | count = 0 |
Build a mapped subgraph from a graph starting at a given node.
This class performs a depth-first traversal of graph g starting from a source node and constructs a mapped copy of all reachable nodes and arcs (the entire graph if connected, or a connected component if not).
The resulting subgraph maintains bidirectional mappings via cookies between the original graph elements and their copies in the subgraph.
Build_Subtree control bit on nodes and arcs.| GT | Graph type (must satisfy Aleph graph concept). |
| SA | Arc filter type (default: Dft_Show_Arc<GT>). |
Definition at line 102 of file tpl_components.H.
|
inline |
Construct a subgraph builder with optional arc filter.
| arc_filter | Arc filter to control which arcs are traversed (default: show all arcs). |
Definition at line 115 of file tpl_components.H.
|
inlineprivate |
Definition at line 121 of file tpl_components.H.
References ARC_BITS, Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subtree, Aleph::Build_Subgraph< GT, SA >::count, Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), IS_ARC_VISITED, IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), Aleph::maps(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_BITS, and Aleph::Build_Subgraph< GT, SA >::sa.
Referenced by Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::operator()(), and Aleph::Build_Subgraph< GT, SA >::operator()().
|
inlineprivate |
Definition at line 168 of file tpl_components.H.
References Aleph::DynList< T >::append(), ARC_BITS, Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subtree, Aleph::Build_Subgraph< GT, SA >::count, GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Build_Subgraph< GT, SA >::gptr, IS_ARC_VISITED, IS_NODE_VISITED, l, Aleph::maps(), NODE_BITS, and Aleph::Build_Subgraph< GT, SA >::sa.
|
inline |
Build a list of all nodes reachable from a source node.
Performs DFS from src and collects all reachable nodes into list.
| [in] | g | Source graph to traverse. |
| [out] | list | Output list to store reachable node pointers. |
| [in] | src | Starting node for the traversal. |
| std::bad_alloc | If memory allocation fails. |
| std::invalid_argument | If src is nullptr. |
Build_Subtree control bit on nodes and arcs. Definition at line 254 of file tpl_components.H.
References ah_invalid_argument_if, Aleph::Build_Subgraph< GT, SA >::count, Aleph::Build_Subgraph< GT, SA >::gptr, and Aleph::maps().
|
inline |
Build a mapped subgraph starting from a specific node.
Performs a DFS traversal from g_src and constructs a mapped copy of all reachable nodes and arcs in sg.
| [in] | g | Source graph to traverse. |
| [out] | sg | Output subgraph (should be empty; will contain mapped copy). |
| [in] | g_src | Starting node for the traversal. |
| std::bad_alloc | If memory allocation fails. |
| std::invalid_argument | If g_src is nullptr. |
Build_Subtree control bit on nodes and arcs. sg are mapped to g via cookies. Definition at line 209 of file tpl_components.H.
References ah_invalid_argument_if, Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::count, Aleph::Build_Subgraph< GT, SA >::gptr, and Aleph::maps().
|
inline |
Build and return a subgraph containing all nodes reachable from src.
| [in] | g | Source graph to traverse. |
| [in] | src | Starting node for the traversal. |
| std::bad_alloc | If memory allocation fails. |
| std::invalid_argument | If src is nullptr. |
Definition at line 229 of file tpl_components.H.
References ah_invalid_argument_if, Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::count, and Aleph::Build_Subgraph< GT, SA >::gptr.
|
private |
Definition at line 106 of file tpl_components.H.
Referenced by Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::operator()(), Aleph::Build_Subgraph< GT, SA >::operator()(), and Aleph::Build_Subgraph< GT, SA >::operator()().
Definition at line 105 of file tpl_components.H.
Referenced by Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Build_Subgraph< GT, SA >::operator()(), Aleph::Build_Subgraph< GT, SA >::operator()(), and Aleph::Build_Subgraph< GT, SA >::operator()().
Definition at line 104 of file tpl_components.H.
Referenced by Aleph::Build_Subgraph< GT, SA >::build_subgraph(), and Aleph::Build_Subgraph< GT, SA >::build_subgraph().