Forward declarations.
Most users should only use StarGraph, which is EbertGraph<int32, int32>, and other type shortcuts; see the bottom of this file.
Definition at line 188 of file ebert_graph.h.
Classes | |
| class | IncomingArcIterator |
| Iterator class for traversing the incoming arcs associated to a given node. More... | |
| class | OutgoingOrOppositeIncomingArcIterator |
| Iterator class for traversing the arcs incident to a given node in the graph. More... | |
Public Types | |
| typedef NodeIndexType | NodeIndex |
| typedef ArcIndexType | ArcIndex |
Public Member Functions | |
| EbertGraph () | |
| EbertGraph (NodeIndexType max_num_nodes, ArcIndexType max_num_arcs) | |
| ~EbertGraph () | |
| bool | CheckArcBounds (const ArcIndexType arc) const |
| Utility function to check that an arc index is within the bounds. More... | |
| bool | CheckArcValidity (const ArcIndexType arc) const |
| Utility function to check that an arc index is within the bounds AND different from kNilArc. More... | |
| NodeIndexType | Tail (const ArcIndexType arc) const |
| Returns the tail or start-node of arc. More... | |
| NodeIndexType | DirectArcTail (const ArcIndexType arc) const |
| Returns the tail or start-node of arc if it is positive (i.e. More... | |
| NodeIndexType | DirectArcHead (const ArcIndexType arc) const |
| Returns the head or end-node of arc if it is positive (i.e. More... | |
| ArcIndexType | DirectArc (const ArcIndexType arc) const |
| Returns the arc in normal/direct direction. More... | |
| ArcIndexType | ReverseArc (const ArcIndexType arc) const |
| Returns the arc in reverse direction. More... | |
| ArcIndexType | Opposite (const ArcIndexType arc) const |
| Returns the opposite arc, i.e the direct arc is the arc is in reverse direction, and the reverse arc if the arc is direct. More... | |
| bool | IsDirect (const ArcIndexType arc) const |
| Returns true if the arc is direct. More... | |
| bool | IsReverse (const ArcIndexType arc) const |
| Returns true if the arc is in the reverse direction. More... | |
| bool | IsOutgoingOrOppositeIncoming (ArcIndexType arc, NodeIndexType node) const |
| Returns true if arc is incident to node. More... | |
| bool | IsIncoming (ArcIndexType arc, NodeIndexType node) const |
| Returns true if arc is incoming to node. More... | |
| bool | IsOutgoing (ArcIndexType arc, NodeIndexType node) const |
| Returns true if arc is outgoing from node. More... | |
| void | BuildRepresentation () |
| Recreates the next_adjacent_arc_ and first_incident_arc_ variables from the array head_ in O(n + m) time. More... | |
| std::string | DebugString () const |
| Returns a debug std::string containing all the information contained in the data structure in raw form. More... | |
| NodeIndexType | Head (const ArcIndexType arc) const |
| Returns the head or end-node of arc. More... | |
| bool | IsNodeValid (NodeIndexType node) const |
| Utility function to check that a node index is within the bounds AND different from kNilNode. More... | |
| bool | Reserve (NodeIndexType new_max_num_nodes, ArcIndexType new_max_num_arcs) |
| Reserves memory needed for max_num_nodes nodes and max_num_arcs arcs. More... | |
| ArcIndexType | AddArc (NodeIndexType tail, NodeIndexType head) |
| Adds an arc to the graph and returns its index. More... | |
| template<typename ArcIndexTypeStrictWeakOrderingFunctor > | |
| void | GroupForwardArcsByFunctor (const ArcIndexTypeStrictWeakOrderingFunctor &compare, PermutationCycleHandler< ArcIndexType > *annotation_handler) |
| ArcIndexType | end_arc_index () const |
| Returns one more than the largest index of an extant direct arc. More... | |
| ArcIndexType | end_arc_index () const |
| Returns one more than the largest index of an extant direct arc. More... | |
| bool | IsNodeValid (NodeIndexType node) const |
| Utility function to check that a node index is within the bounds AND different from kNilNode. More... | |
| NodeIndexType | num_nodes () const |
| Returns the number of nodes in the graph. More... | |
| ArcIndexType | num_arcs () const |
| Returns the number of original arcs in the graph (The ones with positive indices.) More... | |
| NodeIndexType | end_node_index () const |
| Returns one more than the largest index of an extant node, meaning a node that is mentioned as the head or tail of some arc in the graph. More... | |
| NodeIndexType | max_num_nodes () const |
| Returns the maximum possible number of nodes in the graph. More... | |
| ArcIndexType | max_num_arcs () const |
| Returns the maximum possible number of original arcs in the graph. More... | |
| NodeIndexType | max_end_node_index () const |
| Returns one more than the largest valid index of a node. More... | |
| ArcIndexType | max_end_arc_index () const |
| Returns one more than the largest valid index of a direct arc. More... | |
| ArcIndexType | LookUpArc (const NodeIndexType tail, const NodeIndexType head) const |
| Returns the first arc going from tail to head, if it exists, or kNilArc if such an arc does not exist. More... | |
| NodeIndexType | Head (const ArcIndexType arc) const |
| Returns the head or end-node of arc. More... | |
| std::string | NodeDebugString (const NodeIndexType node) const |
| std::string | ArcDebugString (const ArcIndexType arc) const |
Static Public Attributes | |
| static const ArcIndexType | kFirstArc |
| The index of the first arc in the graph. More... | |
| static const NodeIndexType | kFirstNode |
| The index of the first node in the graph. More... | |
| static const ArcIndexType | kNilArc |
| The index of the 'nil' arc in the graph. More... | |
| static const NodeIndexType | kNilNode |
| The index of the 'nil' node in the graph. More... | |
| static const ArcIndexType | kMaxNumArcs |
| The maximum possible number of arcs in the graph. More... | |
| static const NodeIndexType | kMaxNumNodes |
| The maximum possible number of nodes in the graph. More... | |
Protected Member Functions | |
| void | Initialize (NodeIndexType max_num_nodes, ArcIndexType max_num_arcs) |
| ArcIndexType | FirstOutgoingOrOppositeIncomingArc (const NodeIndexType node) const |
| Returns the first arc in node's incidence list. More... | |
| ArcIndexType | NextAdjacentArc (const ArcIndexType arc) const |
| Returns the next arc following the passed argument in its adjacency list. More... | |
| ArcIndexType | NextOutgoingArc (const NodeIndexType unused_node, const ArcIndexType arc) const |
| Returns the outgoing arc following the argument in the adjacency list. More... | |
| NodeIndexType | StartNode (NodeIndexType node) const |
| Returns kNilNode if the graph has no nodes or node if it has at least one node. More... | |
| ArcIndexType | StartArc (ArcIndexType arc) const |
| Returns kNilArc if the graph has no arcs arc if it has at least one arc. More... | |
| NodeIndexType | NextNode (const NodeIndexType node) const |
| Returns the node following the argument in the graph. More... | |
| ArcIndexType | NextArc (const ArcIndexType arc) const |
| Returns the arc following the argument in the graph. More... | |
| ArcIndexType | FirstOutgoingArc (const NodeIndexType node) const |
| Returns the first outgoing arc for node. More... | |
Protected Attributes | |
| ZVector< ArcIndexType > | next_adjacent_arc_ |
| Array of next indices. More... | |
| bool | representation_clean_ |
| Flag to indicate that BuildRepresentation() needs to be called before the adjacency lists are examined. More... | |
Friends | |
| class | EbertGraphBase< NodeIndexType, ArcIndexType, EbertGraph< NodeIndexType, ArcIndexType > > |
| class | StarGraphBase< NodeIndexType, ArcIndexType, EbertGraph< NodeIndexType, ArcIndexType > > |
| typedef ArcIndexType operations_research::EbertGraph< NodeIndexType, ArcIndexType >::ArcIndex |
Definition at line 1224 of file ebert_graph.h.
| typedef NodeIndexType operations_research::EbertGraph< NodeIndexType, ArcIndexType >::NodeIndex |
Definition at line 1223 of file ebert_graph.h.
|
inline |
Definition at line 1226 of file ebert_graph.h.
|
inline |
Definition at line 1228 of file ebert_graph.h.
|
inline |
Definition at line 1232 of file ebert_graph.h.
|
inlineinherited |
Adds an arc to the graph and returns its index.
Returns kNilArc if the arc could not be added.
Definition at line 1001 of file ebert_graph.h.
|
inlineinherited |
Definition at line 310 of file ebert_graph.h.
|
inline |
Recreates the next_adjacent_arc_ and first_incident_arc_ variables from the array head_ in O(n + m) time.
This is useful if head_ array has been sorted according to a given criterion, for example.
Definition at line 1448 of file ebert_graph.h.
|
inline |
Utility function to check that an arc index is within the bounds.
It is exported so that users of the EbertGraph class can use it. To be used in a DCHECK.
Definition at line 1363 of file ebert_graph.h.
|
inline |
Utility function to check that an arc index is within the bounds AND different from kNilArc.
It is exported so that users of the EbertGraph class can use it. To be used in a DCHECK.
Definition at line 1371 of file ebert_graph.h.
|
inline |
Returns a debug std::string containing all the information contained in the data structure in raw form.
Definition at line 1458 of file ebert_graph.h.
|
inline |
Returns the arc in normal/direct direction.
Definition at line 1396 of file ebert_graph.h.
|
inline |
Returns the head or end-node of arc if it is positive (i.e.
it is taken in the direction it was entered in the graph), and the tail or start-node otherwise. 'That' in Ebert's paper.
Definition at line 1391 of file ebert_graph.h.
|
inline |
Returns the tail or start-node of arc if it is positive (i.e.
it is taken in the direction it was entered in the graph), and the head or end-node otherwise. 'This' in Ebert's paper.
Definition at line 1384 of file ebert_graph.h.
|
inlineinherited |
Returns one more than the largest index of an extant direct arc.
To be used as a helper when clients need to dimension or iterate over arrays of arc annotation information.
Definition at line 252 of file ebert_graph.h.
|
inlineinherited |
Returns one more than the largest index of an extant direct arc.
To be used as a helper when clients need to dimension or iterate over arrays of arc annotation information.
Definition at line 252 of file ebert_graph.h.
|
inlineinherited |
Returns one more than the largest index of an extant node, meaning a node that is mentioned as the head or tail of some arc in the graph.
To be used as a helper when clients need to dimension or iterate over arrays of node annotation information.
Definition at line 247 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the first outgoing arc for node.
Definition at line 479 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the first arc in node's incidence list.
Definition at line 1123 of file ebert_graph.h.
|
inlineinherited |
Determine the permutation that groups arcs by their tail nodes.
Start with the identity permutation.
Now we actually permute the head_ array and the scaled_arc_cost_ array according to the sorting permutation.
Finally, rebuild the graph from its permuted head_ array.
Definition at line 1022 of file ebert_graph.h.
|
inlineinherited |
Returns the head or end-node of arc.
Definition at line 297 of file ebert_graph.h.
|
inline |
Returns the head or end-node of arc.
Definition at line 297 of file ebert_graph.h.
|
inlineprotectedinherited |
Definition at line 1112 of file ebert_graph.h.
|
inline |
Returns true if the arc is direct.
Definition at line 1417 of file ebert_graph.h.
|
inline |
Returns true if arc is incoming to node.
Definition at line 1435 of file ebert_graph.h.
|
inlineinherited |
Utility function to check that a node index is within the bounds AND different from kNilNode.
Returns true if node is in the range [kFirstNode .. max_num_nodes_). It is exported so that users of the DerivedGraph class can use it. To be used in a DCHECK; also used internally to validate arguments passed to our methods from clients (e.g., AddArc()).
Definition at line 279 of file ebert_graph.h.
|
inline |
Utility function to check that a node index is within the bounds AND different from kNilNode.
Returns true if node is in the range [kFirstNode .. max_num_nodes_). It is exported so that users of the DerivedGraph class can use it. To be used in a DCHECK; also used internally to validate arguments passed to our methods from clients (e.g., AddArc()).
Definition at line 279 of file ebert_graph.h.
|
inline |
Returns true if arc is outgoing from node.
Definition at line 1440 of file ebert_graph.h.
|
inline |
Returns true if arc is incident to node.
Definition at line 1429 of file ebert_graph.h.
|
inline |
Returns true if the arc is in the reverse direction.
Definition at line 1423 of file ebert_graph.h.
|
inlineinherited |
Returns the first arc going from tail to head, if it exists, or kNilArc if such an arc does not exist.
Definition at line 285 of file ebert_graph.h.
|
inlineinherited |
Returns one more than the largest valid index of a direct arc.
To be used as a helper when clients need to dimension or iterate over arrays of arc annotation information.
Definition at line 271 of file ebert_graph.h.
|
inlineinherited |
Returns one more than the largest valid index of a node.
To be used as a helper when clients need to dimension or iterate over arrays of node annotation information.
Definition at line 264 of file ebert_graph.h.
|
inlineinherited |
Returns the maximum possible number of original arcs in the graph.
(The ones with positive indices.)
Definition at line 259 of file ebert_graph.h.
|
inlineinherited |
Returns the maximum possible number of nodes in the graph.
Definition at line 255 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the next arc following the passed argument in its adjacency list.
Definition at line 1131 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the arc following the argument in the graph.
Returns kNilArc (= end) if the range of arcs has been exhausted. It is called by ArcIterator::Next() and as such does not expect to be passed an argument equal to kNilArc. This is why the return line is simplified from return ( arc == kNilArc || next_arc >= num_arcs_) ? kNilArc : next_arc; to return next_arc < num_arcs_ ? next_arc : kNilArc;
Definition at line 472 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the node following the argument in the graph.
Returns kNilNode (= end) if the range of nodes has been exhausted. It is called by NodeIterator::Next() and as such does not expect to be passed an argument equal to kNilNode. This is why the return line is simplified from return (node == kNilNode || next_node >= num_nodes_) ? kNilNode : next_node; to return next_node < num_nodes_ ? next_node : kNilNode;
Definition at line 458 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns the outgoing arc following the argument in the adjacency list.
Definition at line 1138 of file ebert_graph.h.
|
inlineinherited |
Definition at line 302 of file ebert_graph.h.
|
inlineinherited |
Returns the number of original arcs in the graph (The ones with positive indices.)
Definition at line 241 of file ebert_graph.h.
|
inlineinherited |
Returns the number of nodes in the graph.
Definition at line 237 of file ebert_graph.h.
|
inline |
Returns the opposite arc, i.e the direct arc is the arc is in reverse direction, and the reverse arc if the arc is direct.
Definition at line 1409 of file ebert_graph.h.
|
inlineinherited |
Reserves memory needed for max_num_nodes nodes and max_num_arcs arcs.
Returns false if the parameters passed are not OK. It can be used to enlarge the graph, but does not shrink memory if called with smaller values.
Definition at line 978 of file ebert_graph.h.
|
inline |
Returns the arc in reverse direction.
Definition at line 1402 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns kNilArc if the graph has no arcs arc if it has at least one arc.
Useful for initializing iterators correctly in the case of empty graphs.
Definition at line 445 of file ebert_graph.h.
|
inlineprotectedinherited |
Returns kNilNode if the graph has no nodes or node if it has at least one node.
Useful for initializing iterators correctly in the case of empty graphs.
Definition at line 439 of file ebert_graph.h.
|
inline |
Returns the tail or start-node of arc.
Definition at line 1376 of file ebert_graph.h.
|
friend |
Definition at line 1193 of file ebert_graph.h.
|
friend |
Definition at line 1195 of file ebert_graph.h.
|
static |
The index of the first arc in the graph.
Definition at line 225 of file ebert_graph.h.
|
static |
The index of the first node in the graph.
Definition at line 222 of file ebert_graph.h.
|
staticinherited |
The maximum possible number of arcs in the graph.
(The maximum index is kMaxNumArcs-1, since indices start at 0. Unfortunately we waste a value representing this and the max_num_arcs_ member.)
(The maximum index is kMaxNumArcs-1, since indices start at 0.)
Definition at line 235 of file ebert_graph.h.
|
staticinherited |
The maximum possible number of nodes in the graph.
The maximum possible node index in the graph.
(The maximum index is kMaxNumNodes-1, since indices start at 0. Unfortunately we waste a value representing this and the max_num_nodes_ member.)
Definition at line 230 of file ebert_graph.h.
|
static |
The index of the 'nil' arc in the graph.
Definition at line 219 of file ebert_graph.h.
|
static |
The index of the 'nil' node in the graph.
Definition at line 216 of file ebert_graph.h.
|
protectedinherited |
Array of next indices.
next_adjacent_arc_[i] contains the next arc in the adjacency list of arc i.
Definition at line 1147 of file ebert_graph.h.
|
protectedinherited |
Flag to indicate that BuildRepresentation() needs to be called before the adjacency lists are examined.
Only for DCHECK in debug builds.
Definition at line 1152 of file ebert_graph.h.