|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Adjacency matrix storing copies of graph attributes. More...
#include <tpl_matgraph.H>
Public Types | |
| using | Graph_Type = GT |
| Graph type. | |
| using | Node_Type = typename GT::Node_Type |
| Node attribute type. | |
| using | Arc_Type = typename GT::Arc_Type |
| Arc attribute 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) | |
| const Arc_Type & | null_value () const noexcept |
| Get the null value indicating no arc. | |
| Matrix_Graph (GT &g, const Arc_Type &null, SA &&__sa=SA()) | |
| Construct from graph with null value. | |
| Matrix_Graph (GT &g, const Arc_Type &null, SA &__sa) | |
| Matrix_Graph (Matrix_Graph &other) | |
| Copy constructor. | |
| Matrix_Graph & | operator= (Matrix_Graph &other) |
| Copy assignment. | |
| Matrix_Graph & | operator= (GT &g) |
| Assign from graph. | |
| const Arc_Type & | operator() (long i, long j) const |
| Get arc attribute by indices (const). | |
| Node_Type & | operator() (long i) const |
| Get node attribute by index. | |
| Arc_Type & | operator() (long i, long j) |
| Get/set arc attribute by indices. | |
Private Member Functions | |
| void | copy (Matrix_Graph &other) |
| void | copy (GT &g) |
Private Attributes | |
| DynArray< Node_Type > | nodes |
| DynArray< Arc_Type > | arcs |
| size_t | n = 0 |
| Arc_Type | Null_Value {} |
| SA | sa |
Adjacency matrix storing copies of graph attributes.
Matrix_Graph creates a self-contained adjacency matrix by copying the node and arc attributes from an adjacency list graph. Unlike Map_Matrix_Graph, this matrix does not maintain references to the original graph.
| GT | Graph type |
| SA | Arc filter (default: show all arcs) |
Definition at line 487 of file tpl_matgraph.H.
Arc type.
Definition at line 503 of file tpl_matgraph.H.
| using Aleph::Matrix_Graph< GT, SA >::Arc_Type = typename GT::Arc_Type |
Arc attribute type.
Definition at line 497 of file tpl_matgraph.H.
| using Aleph::Matrix_Graph< GT, SA >::Graph_Type = GT |
Graph type.
Definition at line 491 of file tpl_matgraph.H.
Node type.
Definition at line 500 of file tpl_matgraph.H.
| using Aleph::Matrix_Graph< GT, SA >::Node_Type = typename GT::Node_Type |
Node attribute type.
Definition at line 494 of file tpl_matgraph.H.
|
inline |
Construct from graph with null value.
| g | Source graph |
| null | Value indicating absence of arc |
| __sa | Arc filter |
| std::bad_alloc | if memory allocation fails |
Definition at line 575 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::copy().
|
inline |
Definition at line 581 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::copy().
|
inline |
Copy constructor.
Definition at line 588 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::copy(), and Aleph::maps().
|
inlineprivate |
Definition at line 535 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::arcs, GTNodeCommon< NodeInfo >::get_info(), GTArcCommon< ArcInfo >::get_info(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::matgraph_detail::index_array(), Aleph::Matrix_Graph< GT, SA >::n, Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::Matrix_Graph< GT, SA >::nodes, Aleph::Matrix_Graph< GT, SA >::Null_Value, Aleph::quicksort(), Aleph::Matrix_Graph< GT, SA >::sa, and Aleph::DynArray< T >::set_default_initial_value().
|
inlineprivate |
Definition at line 512 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::arcs, Aleph::DynArray< T >::cut(), Aleph::matgraph_detail::index_array(), Aleph::maps(), Aleph::Matrix_Graph< GT, SA >::n, Aleph::Matrix_Graph< GT, SA >::nodes, Aleph::Matrix_Graph< GT, SA >::Null_Value, Aleph::DynArray< T >::set_default_initial_value(), and Aleph::DynArray< T >::touch().
Referenced by Aleph::Matrix_Graph< GT, SA >::Matrix_Graph(), Aleph::Matrix_Graph< GT, SA >::Matrix_Graph(), Aleph::Matrix_Graph< GT, SA >::Matrix_Graph(), Aleph::Matrix_Graph< GT, SA >::operator=(), and Aleph::Matrix_Graph< GT, SA >::operator=().
|
inlinenoexcept |
Get number of nodes (matrix dimension)
Definition at line 563 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::n.
Referenced by TEST_F().
|
inlinenoexcept |
Get the null value indicating no arc.
Definition at line 566 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::Null_Value.
Referenced by TEST_F().
|
inline |
Get node attribute by index.
| i | Node index |
| std::out_of_range | if i >= n |
Definition at line 623 of file tpl_matgraph.H.
References Aleph::DynArray< T >::access(), ah_out_of_range_error_if, Aleph::maps(), Aleph::Matrix_Graph< GT, SA >::n, and Aleph::Matrix_Graph< GT, SA >::nodes.
|
inline |
Get/set arc attribute by indices.
| i | Source index |
| j | Target index |
Definition at line 636 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::arcs, Aleph::matgraph_detail::checked_index_array(), Aleph::Matrix_Graph< GT, SA >::n, and Aleph::DynArray< T >::touch().
|
inline |
Get arc attribute by indices (const).
| i | Source index |
| j | Target index |
| std::out_of_range | if indices out of bounds |
Definition at line 611 of file tpl_matgraph.H.
References Aleph::DynArray< T >::access(), Aleph::Matrix_Graph< GT, SA >::arcs, Aleph::matgraph_detail::checked_index_array(), Aleph::DynArray< T >::exist(), Aleph::Matrix_Graph< GT, SA >::n, and Aleph::Matrix_Graph< GT, SA >::Null_Value.
|
inline |
Assign from graph.
Definition at line 598 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::copy().
|
inline |
Copy assignment.
Definition at line 591 of file tpl_matgraph.H.
References Aleph::Matrix_Graph< GT, SA >::copy(), and Aleph::maps().
|
private |
Definition at line 507 of file tpl_matgraph.H.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::operator()(), and Aleph::Matrix_Graph< GT, SA >::operator()().
|
mutableprivate |
Definition at line 508 of file tpl_matgraph.H.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::get_num_nodes(), Aleph::Matrix_Graph< GT, SA >::operator()(), Aleph::Matrix_Graph< GT, SA >::operator()(), and Aleph::Matrix_Graph< GT, SA >::operator()().
|
private |
Definition at line 506 of file tpl_matgraph.H.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::copy(), and Aleph::Matrix_Graph< GT, SA >::operator()().
|
mutableprivate |
Definition at line 509 of file tpl_matgraph.H.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Matrix_Graph< GT, SA >::null_value(), and Aleph::Matrix_Graph< GT, SA >::operator()().
Definition at line 510 of file tpl_matgraph.H.
Referenced by Aleph::Matrix_Graph< GT, SA >::copy().