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>
|
| AdjacencyList (const std::int32_t n) |
| Construct trivial adjacency list where each of the n nodes is connected to itself. More...
|
|
template<typename U , typename V , typename = std::enable_if_t< std::is_same<std::vector<T>, std::decay_t<U>>::value && std::is_same<std::vector<std::int32_t>, std::decay_t<V>>::value>> |
| AdjacencyList (U &&data, V &&offsets) |
| Construct adjacency list from arrays of data. More...
|
|
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). More...
|
|
| 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. More...
|
|
std::int32_t | num_nodes () const |
| Get the number of nodes. More...
|
|
int | num_links (int node) const |
| Number of connections for given node. More...
|
|
std::span< T > | links (int node) |
| Get the links (edges) for given node. More...
|
|
std::span< const T > | links (int node) const |
| Get the links (edges) for given node (const version) More...
|
|
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) More...
|
|
template<typename T>
class dolfinx::graph::AdjacencyList< T >
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.
◆ AdjacencyList() [1/3]
Construct trivial adjacency list where each of the n nodes is connected to itself.
- Parameters
-
◆ AdjacencyList() [2/3]
Construct adjacency list from arrays of data.
- Parameters
-
[in] | data | Adjacency array |
[in] | offsets | The index to the adjacency list in the data array for node i |
◆ AdjacencyList() [3/3]
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).
- Parameters
-
[in] | data | Adjacency list data, where std::next(data, i) points to the container of edges for node i . |
◆ links() [1/2]
std::span<T> links |
( |
int |
node | ) |
|
|
inline |
Get the links (edges) for given node.
- Parameters
-
- Returns
- Array of outgoing links for the node. The length will be AdjacencyList::num_links(node).
◆ links() [2/2]
std::span<const T> links |
( |
int |
node | ) |
const |
|
inline |
Get the links (edges) for given node (const version)
- Parameters
-
- Returns
- Array of outgoing links for the node. The length will be AdjacencyList:num_links(node).
◆ num_links()
int num_links |
( |
int |
node | ) |
const |
|
inline |
Number of connections for given node.
- Parameters
-
- Returns
- The number of outgoing links (edges) from the node
◆ num_nodes()
std::int32_t num_nodes |
( |
| ) |
const |
|
inline |
Get the number of nodes.
- Returns
- The number of nodes in the adjacency list
◆ operator==()
Equality operator.
- Returns
- True is the adjacency lists are equal
◆ str()
std::string str |
( |
| ) |
const |
|
inline |
Informal string representation (pretty-print)
- Returns
- String representation of the adjacency list
The documentation for this class was generated from the following files: