|
Aleph-w 7.10.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, SA sa=SA()) | |
| 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, SA sa=SA()) |
| 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, with the filter SA(), as set_list_graph(): also when the matrix is already of g, so that it holds the arcs of g now. | |
| 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, const SA &sa) |
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 1088 of file tpl_matgraph.H.
| using Aleph::Bit_Mat_Graph< GT, SA >::Arc = typename GT::Arc |
Arc type.
Definition at line 1098 of file tpl_matgraph.H.
| using Aleph::Bit_Mat_Graph< GT, SA >::Graph_Type = GT |
Graph type.
Definition at line 1092 of file tpl_matgraph.H.
| using Aleph::Bit_Mat_Graph< GT, SA >::Node = typename GT::Node |
Node type.
Definition at line 1095 of file tpl_matgraph.H.
|
default |
Default constructor (empty matrix)
|
inlineexplicit |
Construct from graph.
| g | Source graph |
| sa | the filter of the arcs: only those that it shows set a bit |
Definition at line 1171 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph().
|
inline |
Copy constructor.
Definition at line 1178 of file tpl_matgraph.H.
|
inlineexplicit |
Construct with dimension only.
| dim | Matrix dimension |
Definition at line 1187 of file tpl_matgraph.H.
|
inlineprivate |
Definition at line 1108 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::Bit_Mat_Graph< GT, SA >::n, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), 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 1212 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 1209 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 1161 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::n.
Referenced by TEST_F(), TEST_F(), TEST_F(), 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 1242 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 1263 of file tpl_matgraph.H.
|
inline |
Access bit by indices (const)
Definition at line 1269 of file tpl_matgraph.H.
|
inline |
Get index of node.
| node | Node pointer |
| std::domain_error | if no graph associated |
Definition at line 1255 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 1275 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 1285 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 1215 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::bit_array, Aleph::Bit_Mat_Graph< GT, SA >::lgraph, Aleph::Bit_Mat_Graph< GT, SA >::n, and Aleph::Bit_Mat_Graph< GT, SA >::nodes.
|
inline |
Assign from graph, with the filter SA(), as set_list_graph(): also when the matrix is already of g, so that it holds the arcs of g now.
Definition at line 1229 of file tpl_matgraph.H.
References Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
inline |
Associate with a graph.
The bits are those of the arcs of g alone: none is kept from the graph that the matrix had.
| g | Graph to associate |
| sa | the filter of the arcs: only those that it shows set a bit |
Definition at line 1200 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(), and Aleph::Bit_Mat_Graph< GT, SA >::lgraph.
Referenced by Aleph::Bit_Mat_Graph< GT, SA >::operator=(), TEST_F(), TEST_F(), and Aleph::warshall_compute_transitive_clausure().
|
private |
Definition at line 1101 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 1102 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=(), and Aleph::Bit_Mat_Graph< GT, SA >::set_list_graph().
|
mutableprivate |
Definition at line 1104 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=().
|
private |
Definition at line 1103 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=().