Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
util::UndirectedAdjacencyListsOfDirectedGraph< Graph > Class Template Reference

#include <util.h>

Classes

class  AdjacencyListIterator
 

Public Types

typedef Graph::OutgoingOrOppositeIncomingArcIterator ArcIterator
 

Public Member Functions

 UndirectedAdjacencyListsOfDirectedGraph (const Graph &graph)
 
BeginEndWrapper< AdjacencyListIteratoroperator[] (int node) const
 Returns a pseudo-container of all the nodes adjacent to "node".
 

Detailed Description

template<class Graph>
class util::UndirectedAdjacencyListsOfDirectedGraph< Graph >

This can be used to view a directed graph (that supports reverse arcs) from graph.h as un undirected graph: operator[](node) returns a pseudo-container that iterates over all nodes adjacent to "node" (from outgoing or incoming arcs). CAVEAT: Self-arcs (aka loops) will appear twice.

Example: ReverseArcsStaticGraph<> dgraph; ... UndirectedAdjacencyListsOfDirectedGraph<decltype(dgraph)> ugraph(dgraph); for (int neighbor_of_node_42 : ugraph[42]) { ... }

Definition at line 103 of file util.h.

Member Typedef Documentation

◆ ArcIterator

template<class Graph >
Graph::OutgoingOrOppositeIncomingArcIterator util::UndirectedAdjacencyListsOfDirectedGraph< Graph >::ArcIterator

Definition at line 108 of file util.h.

Constructor & Destructor Documentation

◆ UndirectedAdjacencyListsOfDirectedGraph()

template<class Graph >
util::UndirectedAdjacencyListsOfDirectedGraph< Graph >::UndirectedAdjacencyListsOfDirectedGraph ( const Graph & graph)
inlineexplicit

Definition at line 105 of file util.h.

Member Function Documentation

◆ operator[]()

template<class Graph >
BeginEndWrapper< AdjacencyListIterator > util::UndirectedAdjacencyListsOfDirectedGraph< Graph >::operator[] ( int node) const
inline

Returns a pseudo-container of all the nodes adjacent to "node".

Definition at line 123 of file util.h.


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