num::structures::multigraph¶
Defined in header <structures/graph/multigraph.hpp>
template <typename Weight, std::integral Index>
class multigraph;
Weighted multigraph representation supporting parallel edges and integer counts.
Members¶
| member | description |
|---|---|
using weight_type = Weight |
|
using index_type = Index |
|
using edge_type = multi_edge<Weight, Index> |
|
explicit multigraph(Index n = 0) |
Construct an empty multigraph with n vertices. |
Index n_vertices() const noexcept |
Number of vertices. |
void add_edge(Index u, Index v, Weight weight = Weight{1}, std::uint8_t count = 1) |
Add an undirected multi-edge between u and v. |
void add_directed_edge(Index u, Index v, Weight weight = Weight{1}, std::uint8_t count = 1) |
Add a directed multi-edge from u to v. |
const array<edge_type> &neighbors(Index u) const |
Const access to neighbor list of vertex u. |
array<edge_type> &neighbors(Index u) |
Mutable access to neighbor list of vertex u. |
const array<array<edge_type>> &adjacency() const noexcept |
Raw underlying adjacency list. |
array<array<edge_type>> &adjacency() noexcept |
Mutable raw underlying adjacency list. |
const array<edge_type> &operator[](Index u) const |
Subscript operator for vertex neighbors. |
array<edge_type> &operator[](Index u) |
|
graph<Weight, Index> to_simple_graph() const |
Convert to simple graph (consolidating parallel edges). |