|
| 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<LinkData>> 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 link (edge) data and offsets.
|
template<typename U, typename V, typename W>
requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<LinkData>> and std::is_convertible_v<std::remove_cvref_t<V>, std::vector<std::int32_t>> and std::is_convertible_v<std::remove_cvref_t<W>, std::vector<NodeData>> |
| AdjacencyList (U &&data, V &&offsets, W &&node_data) |
| Construct adjacency list from arrays of link (edge) data, offsets, and node data.
|
template<typename X> |
| AdjacencyList (const std::vector< X > &data) |
| 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 |
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< LinkData > | links (std::size_t node) |
| Get the links (edges) for given node.
|
std::span< const LinkData > | links (std::size_t node) const |
| Get the links (edges) for given node (const version).
|
const std::vector< LinkData > & | array () const |
| Return contiguous array of links for all nodes (const version).
|
std::vector< LinkData > & | 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().
|
const std::optional< std::vector< NodeData > > & | node_data () const |
std::optional< std::vector< NodeData > > & | node_data () |
std::string | str () const |
| Informal string representation (pretty-print).
|
template<typename LinkData, typename NodeData = std::nullptr_t>
class dolfinx::graph::AdjacencyList< LinkData, NodeData >
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.
The link (edge) type is template parameter, which allows link data to be stored, e.g. a pair with the target node index and the link weight.
Node data can also be stored.
- Template Parameters
-
LinkData_t | Graph link (edge) type. |
NodeData_t | Data type for graph node data. |
template<typename LinkData, typename NodeData = std::nullptr_t>
template<typename U, typename V>
requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<LinkData>> and std::is_convertible_v<std::remove_cvref_t<V>, std::vector<std::int32_t>>
Construct adjacency list from arrays of link (edge) data and offsets.
- Parameters
-
[in] | data | Adjacency lost data array. |
[in] | offsets | Offsets into data for each node, where offsets[i] is the first index in data for node i. The last index in offsets is the equal to the length of data. array for node i. |
template<typename LinkData, typename NodeData = std::nullptr_t>
template<typename U, typename V, typename W>
requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<LinkData>> and std::is_convertible_v<std::remove_cvref_t<V>, std::vector<std::int32_t>> and std::is_convertible_v<std::remove_cvref_t<W>, std::vector<NodeData>>
Construct adjacency list from arrays of link (edge) data, offsets, and node data.
- Parameters
-
[in] | data | Adjacency lost data array. |
[in] | offsets | Offsets into data for each node, where offsets[i] is the first index in data for node i. The last index in offsets is the equal to the length of data. |
[in] | node_data | Node data array where node_data[i] is the data attached to node i. |