num::structures::multigraph¶
Defined in header <structures/graph/multigraph.hpp>
template <typename Weight, std::integral Index>
class multigraph;
Weighted graph that may have parallel edges, with 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 a multigraph on n vertices with no edges. |
Index n_vertices() const noexcept |
Return the number of vertices $\vert V\vert $. |
void add_edge(Index u, Index v, Weight weight = Weight{1}, std::uint8_t count = 1) |
Add the undirected edge \(\{u, v\}\). |
void add_directed_edge(Index u, Index v, Weight weight = Weight{1}, std::uint8_t count = 1) |
Add the directed edge \(u \to v\). |
const array<edge_type> &neighbors(Index u) const |
Return the edges at u. |
array<edge_type> &neighbors(Index u) |
Return the edges at u, for modification. |
const array<array<edge_type>> &adjacency() const noexcept |
Return the adjacency lists. |
array<array<edge_type>> &adjacency() noexcept |
Return the adjacency lists, for modification. |
const array<edge_type> &operator[](Index u) const |
Return the edges at u. |
array<edge_type> &operator[](Index u) |
|
graph<Weight, Index> to_simple_graph() const |
Merge parallel edges into a simple graph. |