![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
Extends the ListGraph by also storing the reverse arcs. This class also documents the Graph interface related to reverse arc.
#include <graph.h>
Classes | |
| struct | OppositeIncomingArcIteratorTag |
| struct | OutgoingArcIteratorTag |
| Do not use directly. See instead the arc iteration functions below. More... | |
| class | OutgoingOrOppositeIncomingArcIterator |
Public Types | |
| using | OutgoingArcIterator |
| using | OppositeIncomingArcIterator |
| using | OutgoingHeadIterator |
| using | IncomingArcIterator |
| Public Types inherited from util::BaseGraph< int32_t, int32_t, true > | |
| typedef int32_t | NodeIndex |
| typedef int32_t | ArcIndex |
Public Member Functions | |
| ReverseArcListGraph () | |
| ReverseArcListGraph (NodeIndexType num_nodes, ArcIndexType arc_capacity) | |
| NodeIndexType | Head (ArcIndexType arc) const |
| NodeIndexType | Tail (ArcIndexType arc) const |
| ArcIndexType | OppositeArc (ArcIndexType arc) const |
| ArcIndexType | OutDegree (NodeIndexType node) const |
| ReverseArcListGraph<>::OutDegree() and InDegree() work in O(degree). | |
| ArcIndexType | InDegree (NodeIndexType node) const |
| BeginEndWrapper< OutgoingArcIterator > | OutgoingArcs (NodeIndexType node) const |
| BeginEndWrapper< OutgoingArcIterator > | OutgoingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| BeginEndWrapper< IncomingArcIterator > | IncomingArcs (NodeIndexType node) const |
| BeginEndWrapper< IncomingArcIterator > | IncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > | OutgoingOrOppositeIncomingArcs (NodeIndexType node) const |
| BeginEndWrapper< OppositeIncomingArcIterator > | OppositeIncomingArcs (NodeIndexType node) const |
| BeginEndWrapper< OppositeIncomingArcIterator > | OppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > | OutgoingOrOppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const |
| BeginEndWrapper< OutgoingHeadIterator > | operator[] (NodeIndexType node) const |
| void | ReserveNodes (NodeIndexType bound) override |
| void | ReserveArcs (ArcIndexType bound) override |
| void | AddNode (NodeIndexType node) |
| ArcIndexType | AddArc (NodeIndexType tail, NodeIndexType head) |
| void | Build () |
| void | Build (std::vector< ArcIndexType > *permutation) |
| bool | IsArcValid (ArcIndexType arc) const |
| Public Member Functions inherited from util::BaseGraph< int32_t, int32_t, true > | |
| BaseGraph () | |
| BaseGraph & | operator= (const BaseGraph &)=default |
| virtual | ~BaseGraph ()=default |
| int32_t | num_nodes () const |
| int32_t | size () const |
| int32_t | num_arcs () const |
| Returns the number of valid arcs in the graph. | |
| IntegerRange< NodeIndex > | AllNodes () const |
| BaseGraph implementation -------------------------------------------------—. | |
| IntegerRange< ArcIndex > | AllForwardArcs () const |
| bool | IsNodeValid (int32_t node) const |
| Returns true if the given node is a valid node of the graph. | |
| bool | IsArcValid (int32_t arc) const |
| int32_t | node_capacity () const |
| Capacity reserved for future nodes, always >= num_nodes_. | |
| int32_t | arc_capacity () const |
| Capacity reserved for future arcs, always >= num_arcs_. | |
| virtual void | ReserveNodes (int32_t bound) |
| virtual void | ReserveArcs (int32_t bound) |
| void | Reserve (int32_t node_capacity, int32_t arc_capacity) |
| void | FreezeCapacities () |
Additional Inherited Members | |
| Static Public Attributes inherited from util::BaseGraph< int32_t, int32_t, true > | |
| static constexpr bool | kHasNegativeReverseArcs |
| static constexpr int32_t | kNilNode |
| static constexpr int32_t | kNilArc |
| Protected Member Functions inherited from util::BaseGraph< int32_t, int32_t, true > | |
| void | ComputeCumulativeSum (internal::Vector< int32_t, int32_t > *v) |
| Functions commented when defined because they are implementation details. | |
| void | BuildStartAndForwardHead (internal::SVector< int32_t, int32_t > *head, internal::Vector< int32_t, int32_t > *start, std::vector< int32_t > *permutation) |
| Protected Attributes inherited from util::BaseGraph< int32_t, int32_t, true > | |
| int32_t | num_nodes_ |
| int32_t | node_capacity_ |
| int32_t | num_arcs_ |
| int32_t | arc_capacity_ |
| bool | const_capacities_ |
| using util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::IncomingArcIterator |
| using util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OppositeIncomingArcIterator |
| using util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator |
| using util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutgoingHeadIterator |
|
inline |
|
inline |
| ArcIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::AddArc | ( | NodeIndexType | tail, |
| NodeIndexType | head ) |
| void util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::AddNode | ( | NodeIndexType | node | ) |
|
inline |
| void util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::Build | ( | std::vector< ArcIndexType > * | permutation | ) |
| NodeIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::Head | ( | ArcIndexType | arc | ) | const |
|
inline |
|
inline |
| ArcIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::InDegree | ( | NodeIndexType | node | ) | const |
|
inline |
| BeginEndWrapper< typename ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutgoingHeadIterator > util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::operator[] | ( | NodeIndexType | node | ) | const |
This loops over the heads of the OutgoingArcs(node). It is just a more convenient way to achieve this. Moreover this interface is used by some graph algorithms.
| ArcIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OppositeArc | ( | ArcIndexType | arc | ) | const |
|
inline |
|
inline |
| ArcIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutDegree | ( | NodeIndexType | node | ) | const |
ReverseArcListGraph<>::OutDegree() and InDegree() work in O(degree).
|
inline |
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), or kNilArc, in which case an empty range is returned.
|
inline |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutgoingOrOppositeIncomingArcs | ( | NodeIndexType | node | ) | const |
| BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::OutgoingOrOppositeIncomingArcsStartingFrom | ( | NodeIndexType | node, |
| ArcIndexType | from ) const |
|
override |
|
override |
| NodeIndexType util::ReverseArcListGraph< NodeIndexType, ArcIndexType >::Tail | ( | ArcIndexType | arc | ) | const |