|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Auxiliary adjacency matrix with custom entry type. More...
#include <tpl_matgraph.H>
Public Types | |
| using | Graph_Type = GT |
| Graph type. | |
| using | Entry_Type = __Entry_Type |
| Entry type stored in matrix. | |
| using | Node_Type = typename GT::Node_Type |
| Node attribute type from graph. | |
| using | Arc_Type = typename GT::Arc_Type |
| Arc attribute type from graph. | |
| using | Node = typename GT::Node |
| Node type from graph. | |
| using | Arc = typename GT::Arc |
| Arc type from graph. | |
Public Member Functions | |
| Node * | operator() (long i) |
| Get node pointer by index. | |
| Node * | operator() (long i) const |
| Get node pointer by index (const). | |
| long | operator() (Node *node) const |
| Get index of node. | |
| Entry_Type & | operator() (long i, long j) |
| Access entry by indices (modifiable). | |
| const Entry_Type & | operator() (long i, long j) const |
| Access entry by indices (const). | |
| Entry_Type & | operator() (Node *src, Node *tgt) |
| Access entry by node pointers (modifiable). | |
| const Entry_Type & | operator() (Node *src, Node *tgt) const |
| Access entry by node pointers (const). | |
| GT & | get_list_graph () noexcept |
| Get reference to underlying graph. | |
| const GT & | get_list_graph () const noexcept |
| Get const reference to underlying graph. | |
| const Entry_Type & | null_value () const noexcept |
| Get the null value. | |
| size_t | get_num_nodes () const noexcept |
| Get number of nodes (matrix dimension) | |
| Ady_Mat (GT &g) | |
| Construct from graph without null value. | |
| Ady_Mat (GT &g, const Entry_Type &null) | |
| Construct from graph with null value. | |
| void | set_null_value (const Entry_Type &null) noexcept |
| Set the null value. | |
| Ady_Mat (Ady_Mat &other) | |
| Copy constructor. | |
| Ady_Mat & | operator= (Ady_Mat &other) |
| Copy assignment. | |
| template<class Operation > | |
| void | operate_all_arcs_list_graph () |
| Apply operation to all arcs from the graph. | |
| template<class Operation > | |
| void | operate_all_arcs_list_graph (void *ptr) |
| Apply operation to all arcs with user data. | |
| template<class Operation > | |
| void | operate_all_arcs_matrix () |
| Apply operation to all matrix entries. | |
| template<class Operation > | |
| void | operate_all_arcs_matrix (void *ptr) |
| Apply operation to all matrix entries with user data. | |
Private Member Functions | |
| void | test_same_graph (const Ady_Mat &other) const |
| void | copy_nodes (GT &g) |
| Ady_Mat & | copy (Ady_Mat &other) |
Private Attributes | |
| GT * | lgraph = nullptr |
| DynArray< Node * > | nodes |
| DynArray< Entry_Type > | mat |
| size_t | num_nodes = 0 |
| Entry_Type | Null_Value {} |
Auxiliary adjacency matrix with custom entry type.
Ady_Mat provides an adjacency matrix with a user-defined entry type, useful for algorithms that need temporary storage or computations different from the graph's native attributes.
| GT | Graph type |
| __Entry_Type | Type of matrix entries |
| SA | Arc filter (default: show all arcs) |
Definition at line 692 of file tpl_matgraph.H.
Arc type from graph.
Definition at line 711 of file tpl_matgraph.H.
| using Aleph::Ady_Mat< GT, __Entry_Type, SA >::Arc_Type = typename GT::Arc_Type |
Arc attribute type from graph.
Definition at line 705 of file tpl_matgraph.H.
| using Aleph::Ady_Mat< GT, __Entry_Type, SA >::Entry_Type = __Entry_Type |
Entry type stored in matrix.
Definition at line 699 of file tpl_matgraph.H.
| using Aleph::Ady_Mat< GT, __Entry_Type, SA >::Graph_Type = GT |
Graph type.
Definition at line 696 of file tpl_matgraph.H.
Node type from graph.
Definition at line 708 of file tpl_matgraph.H.
| using Aleph::Ady_Mat< GT, __Entry_Type, SA >::Node_Type = typename GT::Node_Type |
Node attribute type from graph.
Definition at line 702 of file tpl_matgraph.H.
|
inlineexplicit |
Construct from graph without null value.
Creates matrix with uninitialized entries. Use set_null_value() to define the null value.
| g | Source graph |
| std::bad_alloc | if memory allocation fails |
Definition at line 856 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes().
|
inline |
Construct from graph with null value.
| g | Source graph |
| null | Value indicating no entry |
| std::bad_alloc | if memory allocation fails |
Definition at line 868 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes().
|
inline |
Copy constructor.
Definition at line 878 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy(), and Aleph::maps().
|
inlineprivate |
Definition at line 739 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes(), Aleph::maps(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::Null_Value, and Aleph::Ady_Mat< GT, __Entry_Type, SA >::test_same_graph().
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::Ady_Mat(), and Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator=().
|
inlineprivate |
Definition at line 726 of file tpl_matgraph.H.
References Aleph::DynArray< T >::cut(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::lgraph, Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes, Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes, and Aleph::quicksort().
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::Ady_Mat(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::Ady_Mat(), and Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy().
|
inlinenoexcept |
Get const reference to underlying graph.
Definition at line 839 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::lgraph.
|
inlinenoexcept |
Get reference to underlying graph.
Definition at line 836 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::lgraph.
Referenced by Aleph::Initialize_Dist< AM >::operator()(), and TEST_F().
|
inlinenoexcept |
Get number of nodes (matrix dimension)
Definition at line 845 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes.
Referenced by FloydSimpleGraphTest::get_index(), TEST_F(), and TEST_F().
|
inlinenoexcept |
Get the null value.
Definition at line 842 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::Null_Value.
| void Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph | ( | ) |
Apply operation to all arcs from the graph.
Iterates over all arcs in the underlying graph and invokes:
Where:
| Operation | Functor type with above signature |
Definition at line 945 of file tpl_matgraph.H.
References Aleph::matgraph_detail::index_array(), Aleph::maps(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), nodes, num_nodes, and Aleph::DynArray< T >::touch().
Referenced by TEST_F().
| void Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph | ( | void * | ptr | ) |
Apply operation to all arcs with user data.
Same as operate_all_arcs_list_graph() but passes additional pointer:
| Operation | Functor type |
| ptr | User data pointer |
Definition at line 968 of file tpl_matgraph.H.
References GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::matgraph_detail::index_array(), Aleph::maps(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), nodes, num_nodes, and Aleph::DynArray< T >::touch().
| void Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_matrix | ( | ) |
Apply operation to all matrix entries.
Iterates over all n×n entries and invokes:
| Operation | Functor type |
Definition at line 990 of file tpl_matgraph.H.
References Aleph::matgraph_detail::index_array(), Aleph::maps(), nodes, num_nodes, and Aleph::DynArray< T >::touch().
Referenced by TEST_F().
| void Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_matrix | ( | void * | ptr | ) |
Apply operation to all matrix entries with user data.
| Operation | Functor type |
| ptr | User data pointer |
Definition at line 1008 of file tpl_matgraph.H.
References Aleph::matgraph_detail::index_array(), Aleph::maps(), nodes, num_nodes, and Aleph::DynArray< T >::touch().
|
inline |
Get node pointer by index.
| i | Node index |
| std::out_of_range | if index out of bounds |
Definition at line 757 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes.
|
inline |
Get node pointer by index (const).
| i | Node index |
| std::out_of_range | if index out of bounds |
Definition at line 768 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes.
|
inline |
Access entry by indices (modifiable).
| i | Row index |
| j | Column index |
| std::out_of_range | if indices out of bounds |
Definition at line 791 of file tpl_matgraph.H.
References Aleph::matgraph_detail::checked_index_array(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::mat, Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes, and Aleph::DynArray< T >::touch().
|
inline |
Access entry by indices (const).
| i | Row index |
| j | Column index |
| std::out_of_range | if indices out of bounds |
Definition at line 803 of file tpl_matgraph.H.
References Aleph::DynArray< T >::access(), Aleph::matgraph_detail::checked_index_array(), Aleph::DynArray< T >::exist(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::mat, Aleph::Ady_Mat< GT, __Entry_Type, SA >::Null_Value, and Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes.
|
inline |
Get index of node.
| node | Node pointer |
Definition at line 779 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes, and Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes.
|
inline |
Access entry by node pointers (modifiable).
| src | Source node |
| tgt | Target node |
Definition at line 816 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes, and Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes.
|
inline |
Access entry by node pointers (const).
| src | Source node |
| tgt | Target node |
Definition at line 829 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::nodes, and Aleph::Ady_Mat< GT, __Entry_Type, SA >::num_nodes.
|
inline |
Copy assignment.
Definition at line 881 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy(), and Aleph::maps().
|
inlinenoexcept |
Set the null value.
Definition at line 875 of file tpl_matgraph.H.
References Aleph::Ady_Mat< GT, __Entry_Type, SA >::Null_Value.
Referenced by TEST_F().
|
inlineprivate |
Definition at line 720 of file tpl_matgraph.H.
References ah_domain_error_if, Aleph::Ady_Mat< GT, __Entry_Type, SA >::lgraph, and Aleph::maps().
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy().
|
private |
|
private |
Definition at line 716 of file tpl_matgraph.H.
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), and Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()().
|
private |
Definition at line 715 of file tpl_matgraph.H.
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), and Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()().
|
mutableprivate |
|
mutableprivate |
Definition at line 717 of file tpl_matgraph.H.
Referenced by Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::get_num_nodes(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()(), and Aleph::Ady_Mat< GT, __Entry_Type, SA >::operator()().