DOLFINx 0.7.3
DOLFINx C++ interface
|
This class provides a static adjacency list data structure. It is commonly used to store directed graphs. For each node in the contiguous list of nodes [0, 1, 2, ..., n) it stores the connected nodes. The representation is strictly local, i.e. it is not parallel aware. More...
#include <AdjacencyList.h>
Public Member Functions | |
AdjacencyList (const std::int32_t n) | |
Construct trivial adjacency list where each of the n nodes is connected to itself. | |
template<typename U , typename V > requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<T>> | |
and std::is_convertible_v< std::remove_cvref_t< V >, std::vector< std::int32_t > > | AdjacencyList (U &&data, V &&offsets) |
Construct adjacency list from arrays of data. | |
template<typename X > | |
AdjacencyList (const std::vector< X > &data) | |
Set all connections for all entities (T is a '2D' container, e.g. a std::vector<<std::vector<std::size_t>> , std::vector<<std::set<std::size_t>> , etc). | |
AdjacencyList (const AdjacencyList &list)=default | |
Copy constructor. | |
AdjacencyList (AdjacencyList &&list)=default | |
Move constructor. | |
~AdjacencyList ()=default | |
Destructor. | |
AdjacencyList & | operator= (const AdjacencyList &list)=default |
Assignment operator. | |
AdjacencyList & | operator= (AdjacencyList &&list)=default |
Move assignment operator. | |
bool | operator== (const AdjacencyList &list) const |
Equality operator. | |
std::int32_t | num_nodes () const |
Get the number of nodes. | |
int | num_links (std::size_t node) const |
Number of connections for given node. | |
std::span< T > | links (std::size_t node) |
Get the links (edges) for given node. | |
std::span< const T > | links (std::size_t node) const |
Get the links (edges) for given node (const version) | |
const std::vector< T > & | array () const |
Return contiguous array of links for all nodes (const version) | |
std::vector< T > & | array () |
Return contiguous array of links for all nodes. | |
const std::vector< std::int32_t > & | offsets () const |
Offset for each node in array() (const version) | |
std::vector< std::int32_t > & | offsets () |
Offset for each node in array() | |
std::string | str () const |
Informal string representation (pretty-print) | |
This class provides a static adjacency list data structure. It is commonly used to store directed graphs. For each node in the contiguous list of nodes [0, 1, 2, ..., n) it stores the connected nodes. The representation is strictly local, i.e. it is not parallel aware.
|
inlineexplicit |
Construct trivial adjacency list where each of the n nodes is connected to itself.
[in] | n | Number of nodes |
|
inline |
Construct adjacency list from arrays of data.
[in] | data | Adjacency array |
[in] | offsets | The index to the adjacency list in the data array for node i |
|
inlineexplicit |
Set all connections for all entities (T is a '2D' container, e.g. a std::vector<<std::vector<std::size_t>>
, std::vector<<std::set<std::size_t>>
, etc).
[in] | data | Adjacency list data, where std::next(data, i) points to the container of edges for node i . |
Get the links (edges) for given node.
[in] | node | Node index |
Get the links (edges) for given node (const version)
[in] | node | Node index |
Number of connections for given node.
[in] | node | Node index |
Get the number of nodes.
Equality operator.
Informal string representation (pretty-print)