template<typename NodeIndexType = int32, typename ArcIndexType = int32>
class util::ReverseArcListGraph< NodeIndexType, ArcIndexType >
Extends the ListGraph by also storing the reverse arcs.
This class also documents the Graph interface related to reverse arc.
- NodeIndexType can be unsigned, but ArcIndexType must be signed.
- It has most of the same advantanges and disadvantages as ListGraph.
- It takes 2 * ArcIndexType * node_capacity()
Definition at line 459 of file graph.h.
|
| | ReverseArcListGraph () |
| |
| | ReverseArcListGraph (NodeIndexType num_nodes, ArcIndexType arc_capacity) |
| |
| ArcIndexType | OppositeArc (ArcIndexType arc) const |
| | Returns the opposite arc of a given arc. More...
|
| |
| ArcIndexType | OutDegree (NodeIndexType node) const |
| | ReverseArcListGraph<>::OutDegree() and ::InDegree() work in O(degree). More...
|
| |
| ArcIndexType | InDegree (NodeIndexType node) const |
| |
| BeginEndWrapper< OutgoingArcIterator > | OutgoingArcs (NodeIndexType node) const |
| | Arc iterations functions over the arcs touching a node (see the top-level comment for the different types). More...
|
| |
| BeginEndWrapper< IncomingArcIterator > | IncomingArcs (NodeIndexType node) const |
| |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > | OutgoingOrOppositeIncomingArcs (NodeIndexType node) const |
| |
| BeginEndWrapper< OppositeIncomingArcIterator > | OppositeIncomingArcs (NodeIndexType node) const |
| |
| BeginEndWrapper< OutgoingArcIterator > | OutgoingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| |
| BeginEndWrapper< IncomingArcIterator > | IncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > | OutgoingOrOppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| |
| BeginEndWrapper< OppositeIncomingArcIterator > | OppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| |
| BeginEndWrapper< OutgoingHeadIterator > | operator[] (NodeIndexType node) const |
| | This loops over the heads of the OutgoingArcs(node). More...
|
| |
| NodeIndexType | Head (ArcIndexType arc) const |
| |
| NodeIndexType | Tail (ArcIndexType arc) const |
| |
| void | ReserveNodes (NodeIndexType bound) override |
| | Changes the graph capacities. More...
|
| |
| void | ReserveArcs (ArcIndexType bound) override |
| |
| void | AddNode (NodeIndexType node) |
| |
| ArcIndexType | AddArc (NodeIndexType tail, NodeIndexType head) |
| |
| void | Build () |
| |
| void | Build (std::vector< ArcIndexType > *permutation) |
| |
| NodeIndexType | num_nodes () const |
| | Returns the number of valid nodes in the graph. More...
|
| |
| ArcIndexType | num_arcs () const |
| | Returns the number of valid arcs in the graph. More...
|
| |
| IntegerRange< NodeIndex > | AllNodes () const |
| | Allows nice range-based for loop: for (const NodeIndex node : graph.AllNodes()) { ... More...
|
| |
| IntegerRange< ArcIndex > | AllForwardArcs () const |
| |
| bool | IsNodeValid (NodeIndexType node) const |
| | Returns true if the given node is a valid node of the graph. More...
|
| |
| bool | IsArcValid (ArcIndexType arc) const |
| | Returns true if the given arc is a valid arc of the graph. More...
|
| |
| NodeIndexType | node_capacity () const |
| | Capacity reserved for future nodes, always >= num_nodes_. More...
|
| |
| ArcIndexType | arc_capacity () const |
| | Capacity reserved for future arcs, always >= num_arcs_. More...
|
| |
| void | Reserve (NodeIndexType node_capacity, ArcIndexType arc_capacity) |
| |
| void | FreezeCapacities () |
| | FreezeCapacities() makes any future attempt to change the graph capacities crash in DEBUG mode. More...
|
| |
| void | GroupForwardArcsByFunctor (const A &a, B *b) |
| |
| ArcIndexType | max_end_arc_index () const |
| |
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::BuildStartAndForwardHead |
( |
SVector< NodeIndexType > * |
head, |
|
|
std::vector< ArcIndexType > * |
start, |
|
|
std::vector< ArcIndexType > * |
permutation |
|
) |
| |
|
protectedinherited |
Given the tail of arc #i in (*head)[i] and the head of arc #i in (*head)[~i].
- Reorder the arc by increasing tail.
- Put the head of the new arc #i in (*head)[i].
- Put in start[i] the index of the first arc with tail >= i.
- Update "permutation" to reflect the change, unless it is NULL.
Computes the outgoing degree of each nodes and check if we need to permute something or not. Note that the tails are currently stored in the positive range of the SVector head.
Abort early if we do not need the permutation: we only need to put the heads in the positive range.
Computes the forward arc permutation.
- Note
- this temporarily alters the start vector.
Restore in (*start)[i] the index of the first arc with tail >= i.
Permutes the head into their final position in head. We do not need the tails anymore at this point.
Definition at line 995 of file graph.h.
template<typename NodeIndexType = int32, typename ArcIndexType = int32>
Arc iterations functions over the arcs touching a node (see the top-level comment for the different types).
To be used as follows: for (const Graph::ArcIndex arc : IterationFunction(node)) { ... }
The StartingFrom() version are similar, but restart the iteration from a given arc position (which must be valid in the iteration context).
template<typename NodeIndexType , typename ArcIndexType >
Changes the graph capacities.
The functions will fail in debug mode if:
- const_capacities_ is true.
- A valid node does not fall into the new node range.
- A valid arc does not fall into the new arc range. In non-debug mode, const_capacities_ is ignored and nothing will happen if the new capacity value for the arcs or the nodes is too small.
Reimplemented from util::BaseGraph< NodeIndexType, ArcIndexType, true >.
Definition at line 1476 of file graph.h.