5.7. ordered_graph.hpp¶
Full path: graph_canon/ordered_graph.hpp
-
template<typename
GraphT
, typenameIndexMapT
, boolWithInEdges
= false>
classordered_graph
¶ A graph adaptor that ensures iteration order in correspondence with a given vertex index map.
Requires
Graph
to model aVertexListGraph
and anIncidenceGraph
, andIndexMap
aReadableProperyMap
. The ordered graph models those concepts as well asAdjacencyGraph
. IfWithInEdges
istrue
, andGraph
models aBidirectionalGraph
, then the ordered graph will model theBidirectionalGraph
concept as well.When iterating through the range of vertices, adjacency vertices, and inverse-adjacent vertices, the vertices will appear in sorted order with respect to the given index map. When iterating through out-edges and in-edges, the edges will appear in sorted order with respect to the index of the neighbouring vertices. If the adapted graph has parallel edges, those will be ordered according to a predicate given to the constructor.
-
using
IndexMap
= IndexMapT¶ The type of the vertex index map representing the order to use for iteration.
-
template<typename
EdgeLess
>ordered_graph
(const Graph &g, IndexMap idx, EdgeLess edge_less)¶ Construct an ordered graph from a graph and a given index map (the graph is stored by reference). The binary edge predicate
edge_less
is used when the graph has parallel edges (hint: givealways_false()
for simple graphs).
-
using
-
template<bool
WithInEdges
, typenameGraph
, typenameIndexMap
, typenameEdgeLess
>
ordered_graph<Graph, IndexMap, WithInEdges>make_ordered_graph
(const Graph &g, IndexMap idx, EdgeLess edge_less)¶ - Returns
ordered_graph<Graph, IndexMap, WithInEdges>(g, idx, edge_less)