Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator Class Reference

#include <graph.h>

Inheritance diagram for util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator:
util::BaseGraph< NodeIndexType, ArcIndexType, true >

Public Member Functions

 OutgoingArcIterator (const OutgoingArcIterator &)=default
 
OutgoingArcIteratoroperator= (const OutgoingArcIterator &)=default
 
 OutgoingArcIterator (const ReverseArcMixedGraph &graph, NodeIndexType node)
 
 OutgoingArcIterator (const ReverseArcMixedGraph &graph, NodeIndexType node, ArcIndexType arc)
 
bool Ok () const
 
ArcIndexType Index () const
 
void Next ()
 
 DEFINE_STL_ITERATOR_FUNCTIONS (OutgoingArcIterator)
 
bool IsArcValid (ArcIndexType arc) const
 
 ReverseArcMixedGraph ()
 
 ReverseArcMixedGraph (NodeIndexType num_nodes, ArcIndexType arc_capacity)
 
ArcIndexType OutDegree (NodeIndexType node) const
 
ArcIndexType InDegree (NodeIndexType node) const
 
BeginEndWrapper< OutgoingArcIteratorOutgoingArcs (NodeIndexType node) const
 
BeginEndWrapper< IncomingArcIteratorIncomingArcs (NodeIndexType node) const
 
BeginEndWrapper< OutgoingOrOppositeIncomingArcIteratorOutgoingOrOppositeIncomingArcs (NodeIndexType node) const
 
BeginEndWrapper< OppositeIncomingArcIteratorOppositeIncomingArcs (NodeIndexType node) const
 
BeginEndWrapper< OutgoingArcIteratorOutgoingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const
 
BeginEndWrapper< IncomingArcIteratorIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const
 
BeginEndWrapper< OutgoingOrOppositeIncomingArcIteratorOutgoingOrOppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const
 
BeginEndWrapper< OppositeIncomingArcIteratorOppositeIncomingArcsStartingFrom (NodeIndexType node, ArcIndexType from) const
 
absl::Span< const NodeIndexType > operator[] (NodeIndexType node) const
 
ArcIndexType OppositeArc (ArcIndexType arc) const
 
NodeIndexType Head (ArcIndexType arc) const
 
NodeIndexType Tail (ArcIndexType arc) const
 
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< NodeIndexType, ArcIndexType, true >
 BaseGraph ()
 
 BaseGraph (const BaseGraph &)=default
 
BaseGraphoperator= (const BaseGraph &)=default
 
virtual ~BaseGraph ()=default
 
NodeIndexType num_nodes () const
 
NodeIndexType size () const
 
ArcIndexType num_arcs () const
 Returns the number of valid arcs in the graph.
 
IntegerRange< NodeIndexAllNodes () const
 BaseGraph implementation -------------------------------------------------—.
 
IntegerRange< ArcIndexAllForwardArcs () const
 
bool IsNodeValid (NodeIndexType node) const
 Returns true if the given node is a valid node of the graph.
 
bool IsArcValid (ArcIndexType arc) const
 
NodeIndexType node_capacity () const
 Capacity reserved for future nodes, always >= num_nodes_.
 
ArcIndexType arc_capacity () const
 Capacity reserved for future arcs, always >= num_arcs_.
 
virtual void ReserveNodes (NodeIndexType bound)
 
void Reserve (NodeIndexType node_capacity, ArcIndexType arc_capacity)
 
void FreezeCapacities ()
 
 BaseGraph ()
 
 BaseGraph (const BaseGraph &)=default
 
BaseGraphoperator= (const BaseGraph &)=default
 
virtual ~BaseGraph ()=default
 
NodeIndexType num_nodes () const
 
NodeIndexType size () const
 
ArcIndexType num_arcs () const
 Returns the number of valid arcs in the graph.
 
IntegerRange< NodeIndexAllNodes () const
 BaseGraph implementation -------------------------------------------------—.
 
IntegerRange< ArcIndexAllForwardArcs () const
 
bool IsNodeValid (NodeIndexType node) const
 Returns true if the given node is a valid node of the graph.
 
bool IsArcValid (ArcIndexType arc) const
 
NodeIndexType node_capacity () const
 Capacity reserved for future nodes, always >= num_nodes_.
 
ArcIndexType arc_capacity () const
 Capacity reserved for future arcs, always >= num_arcs_.
 
virtual void ReserveNodes (NodeIndexType bound)
 
void Reserve (NodeIndexType node_capacity, ArcIndexType arc_capacity)
 
void FreezeCapacities ()
 

Additional Inherited Members

- Public Types inherited from util::BaseGraph< NodeIndexType, ArcIndexType, true >
typedef NodeIndexType NodeIndex
 
typedef ArcIndexType ArcIndex
 
- Static Public Attributes inherited from util::BaseGraph< NodeIndexType, ArcIndexType, true >
static constexpr bool kHasNegativeReverseArcs
 
static const NodeIndexType kNilNode
 
static const ArcIndexType kNilArc
 
static constexpr bool kHasNegativeReverseArcs
 
static const NodeIndexType kNilNode
 
static const ArcIndexType kNilArc
 
- Protected Member Functions inherited from util::BaseGraph< NodeIndexType, ArcIndexType, true >
void ComputeCumulativeSum (std::vector< ArcIndexType > *v)
 Functions commented when defined because they are implementation details.
 
void BuildStartAndForwardHead (SVector< NodeIndexType > *head, std::vector< ArcIndexType > *start, std::vector< ArcIndexType > *permutation)
 
void ComputeCumulativeSum (std::vector< ArcIndexType > *v)
 Functions commented when defined because they are implementation details.
 
void BuildStartAndForwardHead (SVector< NodeIndexType > *head, std::vector< ArcIndexType > *start, std::vector< ArcIndexType > *permutation)
 
- Protected Attributes inherited from util::BaseGraph< NodeIndexType, ArcIndexType, true >
NodeIndexType num_nodes_
 
NodeIndexType node_capacity_
 
ArcIndexType num_arcs_
 
ArcIndexType arc_capacity_
 
bool const_capacities_
 
NodeIndexType num_nodes_
 
NodeIndexType node_capacity_
 
ArcIndexType num_arcs_
 
ArcIndexType arc_capacity_
 
bool const_capacities_
 

Detailed Description

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
class util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator

Definition at line 2106 of file graph.h.

Constructor & Destructor Documentation

◆ OutgoingArcIterator() [1/3]

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::OutgoingArcIterator ( const OutgoingArcIterator & )
default

◆ OutgoingArcIterator() [2/3]

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::OutgoingArcIterator ( const ReverseArcMixedGraph & graph,
NodeIndexType node )
inline

Definition at line 2110 of file graph.h.

◆ OutgoingArcIterator() [3/3]

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::OutgoingArcIterator ( const ReverseArcMixedGraph & graph,
NodeIndexType node,
ArcIndexType arc )
inline

Definition at line 2112 of file graph.h.

Member Function Documentation

◆ AddArc()

ArcIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::AddArc ( NodeIndexType tail,
NodeIndexType head )

We inverse head and tail here because it is more convenient this way during build time, see Build().

Definition at line 710 of file graph.h.

◆ AddNode()

void util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::AddNode ( NodeIndexType node)

Definition at line 709 of file graph.h.

◆ Build() [1/2]

void util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::Build ( )
inline

Definition at line 712 of file graph.h.

◆ Build() [2/2]

void util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::Build ( std::vector< ArcIndexType > * permutation)

Fill tails.

Fill information for iterating over reverse arcs.

Definition at line 713 of file graph.h.

◆ DEFINE_STL_ITERATOR_FUNCTIONS()

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::DEFINE_STL_ITERATOR_FUNCTIONS ( OutgoingArcIterator )
Todo
(user): we lose a bit by returning a BeginEndWrapper<> on top of this iterator rather than a simple IntegerRange on the arc indices.

◆ Head()

NodeIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::Head ( ArcIndexType arc) const
Todo
(user): support Head() and Tail() before Build(), like StaticGraph<>.

Definition at line 705 of file graph.h.

◆ IncomingArcs()

BeginEndWrapper< IncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::IncomingArcs ( NodeIndexType node) const

◆ IncomingArcsStartingFrom()

BeginEndWrapper< IncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::IncomingArcsStartingFrom ( NodeIndexType node,
ArcIndexType from ) const

◆ InDegree()

ArcIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::InDegree ( NodeIndexType node) const

Definition at line 680 of file graph.h.

◆ Index()

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
ArcIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::Index ( ) const
inline

Definition at line 2120 of file graph.h.

◆ IsArcValid() [1/2]

( ArcIndexType arc) const

Returns true if the given arc is a valid arc of the graph.

Note
the arc validity range changes for graph with reverse arcs.

◆ IsArcValid() [2/2]

bool util::BaseGraph< NodeIndexType, ArcIndexType, HasNegativeReverseArcs >::IsArcValid ( ArcIndexType arc) const
inline

Returns true if the given arc is a valid arc of the graph.

Note
the arc validity range changes for graph with reverse arcs.

Definition at line 664 of file graph.h.

◆ Next()

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
void util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::Next ( )
inline

Definition at line 2121 of file graph.h.

◆ Ok()

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
bool util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::Ok ( ) const
inline

Definition at line 2119 of file graph.h.

◆ operator=()

template<typename NodeIndexType = int32_t, typename ArcIndexType = int32_t>
OutgoingArcIterator & util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcIterator::operator= ( const OutgoingArcIterator & )
default

◆ operator[]()

absl::Span< const NodeIndexType > util::ReverseArcMixedGraph< 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.

Definition at line 701 of file graph.h.

◆ OppositeArc()

ArcIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OppositeArc ( ArcIndexType arc) const

Definition at line 703 of file graph.h.

◆ OppositeIncomingArcs()

BeginEndWrapper< OppositeIncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OppositeIncomingArcs ( NodeIndexType node) const

◆ OppositeIncomingArcsStartingFrom()

BeginEndWrapper< OppositeIncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OppositeIncomingArcsStartingFrom ( NodeIndexType node,
ArcIndexType from ) const

◆ OutDegree()

ArcIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutDegree ( NodeIndexType node) const

Definition at line 679 of file graph.h.

◆ OutgoingArcs()

BeginEndWrapper< OutgoingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcs ( NodeIndexType node) const

◆ OutgoingArcsStartingFrom()

BeginEndWrapper< OutgoingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingArcsStartingFrom ( NodeIndexType node,
ArcIndexType from ) const

◆ OutgoingOrOppositeIncomingArcs()

BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingOrOppositeIncomingArcs ( NodeIndexType node) const

◆ OutgoingOrOppositeIncomingArcsStartingFrom()

BeginEndWrapper< OutgoingOrOppositeIncomingArcIterator > util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::OutgoingOrOppositeIncomingArcsStartingFrom ( NodeIndexType node,
ArcIndexType from ) const

◆ ReserveArcs()

void util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::ReserveArcs ( ArcIndexType bound)
overridevirtual

Reimplemented from util::BaseGraph< NodeIndexType, ArcIndexType, true >.

Definition at line 708 of file graph.h.

◆ ReverseArcMixedGraph() [1/2]

util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::ReverseArcMixedGraph ( )
inline

Definition at line 665 of file graph.h.

◆ ReverseArcMixedGraph() [2/2]

util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::ReverseArcMixedGraph ( NodeIndexType num_nodes,
ArcIndexType arc_capacity )
inline

Definition at line 666 of file graph.h.

◆ Tail()

NodeIndexType util::ReverseArcMixedGraph< NodeIndexType, ArcIndexType >::Tail ( ArcIndexType arc) const

Definition at line 706 of file graph.h.


The documentation for this class was generated from the following file: