template<typename NodeIndexType = int32, typename ArcIndexType = int32, bool HasReverseArcs = false>
class util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >
Base class of all Graphs implemented here.
The default value for the graph index types is int32 since allmost all graphs that fit into memory do not need bigger indices.
- Note
- The type can be unsigned, except for the graphs with reverse arcs where the ArcIndexType must be signed, but not necessarly the NodeIndexType.
Definition at line 184 of file graph.h.
template<typename NodeIndexType , typename ArcIndexType , bool HasReverseArcs>
| IntegerRange< NodeIndexType > util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::AllNodes |
( |
| ) |
const |
Allows nice range-based for loop: for (const NodeIndex node : graph.AllNodes()) { ...
BaseGraph implementation -------------------------------------------------—.
} for (const ArcIndex arc : graph.AllForwardArcs()) { ... }
Definition at line 929 of file graph.h.
template<typename NodeIndexType, typename ArcIndexType, bool HasReverseArcs>
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::BuildStartAndForwardHead |
( |
SVector< NodeIndexType > * |
head, |
|
|
std::vector< ArcIndexType > * |
start, |
|
|
std::vector< ArcIndexType > * |
permutation |
|
) |
| |
|
protected |
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 , typename ArcIndexType, bool HasReverseArcs>
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::ComputeCumulativeSum |
( |
std::vector< ArcIndexType > * |
v | ) |
|
|
protected |
Functions commented when defined because they are implementation details.
Computes the cummulative sum of the entry in v.
We only use it with in/out degree distribution, hence the Check() at the end.
Definition at line 978 of file graph.h.
template<typename NodeIndexType = int32, typename ArcIndexType = int32, bool HasReverseArcs = false>
template<typename A , typename B >
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::GroupForwardArcsByFunctor |
( |
const A & |
a, |
|
|
B * |
b |
|
) |
| |
|
inline |
- Todo:
- (user): remove the public functions below.
They are just here during the transition from the old ebert_graph api to this new graph api.
Definition at line 264 of file graph.h.
template<typename NodeIndexType = int32, typename ArcIndexType = int32, bool HasReverseArcs = false>
| virtual void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::ReserveNodes |
( |
NodeIndexType |
bound | ) |
|
|
inlinevirtual |
template<typename NodeIndexType = int32, typename ArcIndexType = int32, bool HasReverseArcs = false>
| const NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::kNilNode |
|
static |
Initial value:=
std::numeric_limits<NodeIndexType>::max()
Constants that will never be a valid node or arc.
They are the maximum possible node and arc capacity.
Definition at line 258 of file graph.h.