|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Bit matrix for graph connectivity. More...
#include <tpl_matgraph.H>
Classes | |
| struct | Proxy |
| Proxy for bit access. More... | |
Public Types | |
| using | Graph_Type = GT |
| Graph type. | |
| using | Node = typename GT::Node |
| Node type. | |
| using | Arc = typename GT::Arc |
| Arc type. | |
Public Member Functions | |
| size_t | get_num_nodes () const noexcept |
| Get number of nodes (matrix dimension) | |
| Bit_Mat_Graph ()=default | |
| Default constructor (empty matrix) | |
| Bit_Mat_Graph (GT &g) | |
| Construct from graph. | |
| Bit_Mat_Graph (const Bit_Mat_Graph &other) | |
| Copy constructor. | |
| Bit_Mat_Graph (size_t dim) | |
| Construct with dimension only. | |
| void | set_list_graph (GT &g) |
| Associate with a graph. | |
| GT * | get_list_graph () noexcept |
| Get pointer to associated graph (nullptr if none) | |
| const GT * | get_list_graph () const noexcept |
| Get pointer to associated graph (const) | |
| Bit_Mat_Graph & | operator= (const Bit_Mat_Graph &other) |
| Copy assignment. | |
| Bit_Mat_Graph & | operator= (GT &g) |
| Assign from graph. | |
| Node * | operator() (long i) |
| Get node by index. | |
| long | operator() (Node *node) const |
| Get index of node. | |
| Proxy | operator() (long i, long j) |
| Access bit by indices. | |
| Proxy | operator() (long i, long j) const |
| Access bit by indices (const) | |
| Proxy | operator() (Node *src_node, Node *tgt_node) |
| Access bit by node pointers. | |
| Proxy | operator() (Node *src_node, Node *tgt_node) const |
| Access bit by node pointers (const) | |
Private Member Functions | |
| void | copy_list_graph (GT &g) |
Private Attributes | |
| BitArray | bit_array |
| GT * | lgraph = nullptr |
| DynArray< typename GT::Node * > | nodes |
| size_t | n = 0 |
Bit matrix for graph connectivity.
Bit_Mat_Graph provides a compact bit matrix representation for connectivity queries. Each entry uses only 1 bit: 1 indicates an arc exists, 0 indicates no arc.
| GT | Graph type |
| SA | Arc filter |
Definition at line 1067 of file tpl_matgraph.H.
Arc type.
Definition at line 1077 of file tpl_matgraph.H.
| using Aleph::Bit_Mat_Graph< GT, SA >::Graph_Type = GT |
Graph type.
Definition at line 1071 of file tpl_matgraph.H.
Node type.
Definition at line 1074 of file tpl_matgraph.H.
|
default |
Default constructor (empty matrix)
|
inlineexplicit |
Construct from graph.
| g | Source graph |
Definition at line 1147 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph().
|
inline |
Copy constructor.
Definition at line 1154 of file tpl_matgraph.H.
|
inlineexplicit |
Construct with dimension only.
| dim | Matrix dimension |
Definition at line 1163 of file tpl_matgraph.H.
|
inlineprivate |
Definition at line 1085 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::bit_array, Aleph::DynArray< T >::cut(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::matgraph_detail::index_array(), Aleph::maps(), Aleph::Bit_Mat_Graph< GT, SA >::n, Aleph::Bit_Mat_Graph< GT, SA >::nodes, and Aleph::quicksort().
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::Bit_Mat_Graph(), and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
inlinenoexcept |
Get pointer to associated graph (const)
Definition at line 1183 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::lgraph.
|
inlinenoexcept |
Get pointer to associated graph (nullptr if none)
Definition at line 1180 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::lgraph.
Referenced by TEST_F(), TEST_F(), TEST_F(), and Aleph::warshall_compute_transitive_clausure().
|
inlinenoexcept |
Get number of nodes (matrix dimension)
Definition at line 1138 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::n.
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::warshall_compute_transitive_clausure().
|
inline |
Get node by index.
| i | Node index |
| std::domain_error | if no graph associated |
| std::out_of_range | if index out of bounds |
Definition at line 1213 of file tpl_matgraph.H.
References ah_domain_error_if, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Access bit by indices.
Definition at line 1234 of file tpl_matgraph.H.
|
inline |
Access bit by indices (const)
Definition at line 1240 of file tpl_matgraph.H.
|
inline |
Get index of node.
| node | Node pointer |
| std::domain_error | if no graph associated |
Definition at line 1226 of file tpl_matgraph.H.
References ah_domain_error_if, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::Bit_Mat_Graph< GT, SA >::n, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Access bit by node pointers.
Definition at line 1246 of file tpl_matgraph.H.
References ah_domain_error_if, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::Bit_Mat_Graph< GT, SA >::n, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Access bit by node pointers (const)
Definition at line 1256 of file tpl_matgraph.H.
References ah_domain_error_if, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::Bit_Mat_Graph< GT, SA >::n, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Copy assignment.
Definition at line 1186 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::bit_array, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::maps(), Aleph::Bit_Mat_Graph< GT, SA >::n, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Assign from graph.
Definition at line 1199 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::lgraph, and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
inline |
Associate with a graph.
| g | Graph to associate |
Definition at line 1171 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::bit_array, Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::maps(), and Aleph::BitArray::set_size().
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::operator=(), TEST_F(), and Aleph::warshall_compute_transitive_clausure().
|
private |
Definition at line 1080 of file tpl_matgraph.H.
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::operator=(), and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
private |
Definition at line 1081 of file tpl_matgraph.H.
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::get_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::get_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator=(), Aleph::Bit_Mat_Graph< GT, SA >::operator=(), and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
mutableprivate |
Definition at line 1083 of file tpl_matgraph.H.
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::get_num_nodes(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), and Aleph::Bit_Mat_Graph< GT, SA >::operator=().
Definition at line 1082 of file tpl_matgraph.H.
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), Aleph::Bit_Mat_Graph< GT, SA >::operator()(), and Aleph::Bit_Mat_Graph< GT, SA >::operator=().