CompleteGraph implementation ---------------------------------------------— Nodes and arcs are implicit and not stored.
More...
#include <graph.h>
|
| typedef NodeIndexType | NodeIndex |
| | Typedef so you can use Graph::NodeIndex and Graph::ArcIndex to be generic but also to improve the readability of your code. More...
|
| |
| typedef ArcIndexType | ArcIndex |
| |
|
| static const NodeIndexType | kNilNode |
| | Constants that will never be a valid node or arc. More...
|
| |
| static const ArcIndexType | kNilArc |
| |
|
| void | ComputeCumulativeSum (std::vector< ArcIndexType > *v) |
| | Functions commented when defined because they are implementation details. More...
|
| |
| void | BuildStartAndForwardHead (SVector< NodeIndexType > *head, std::vector< ArcIndexType > *start, std::vector< ArcIndexType > *permutation) |
| | Given the tail of arc #i in (*head)[i] and the head of arc #i in (*head)[~i]. More...
|
| |
template<typename NodeIndexType = int32, typename ArcIndexType = int32>
class util::CompleteGraph< NodeIndexType, ArcIndexType >
CompleteGraph implementation ---------------------------------------------— Nodes and arcs are implicit and not stored.
Definition at line 2174 of file graph.h.
◆ ArcIndex
◆ NodeIndex
Typedef so you can use Graph::NodeIndex and Graph::ArcIndex to be generic but also to improve the readability of your code.
We also recommend that you define a typedef ... Graph; for readability.
Definition at line 189 of file graph.h.
◆ CompleteGraph()
template<typename NodeIndexType = int32, typename ArcIndexType = int32>
Builds a complete graph with num_nodes nodes.
Definition at line 2184 of file graph.h.
◆ AllForwardArcs()
| IntegerRange< ArcIndexType > util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::AllForwardArcs |
( |
| ) |
const |
|
inherited |
◆ AllNodes()
| IntegerRange< NodeIndexType > util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::AllNodes |
( |
| ) |
const |
|
inherited |
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.
◆ arc_capacity()
| ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::arc_capacity |
( |
| ) |
const |
|
inherited |
Capacity reserved for future arcs, always >= num_arcs_.
- Todo:
- (user): Same questions as the ones in node_capacity().
Definition at line 959 of file graph.h.
◆ BuildStartAndForwardHead()
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::BuildStartAndForwardHead |
( |
SVector< NodeIndexType > * |
head, |
|
|
std::vector< ArcIndexType > * |
start, |
|
|
std::vector< ArcIndexType > * |
permutation |
|
) |
| |
|
protectedinherited |
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.
◆ ComputeCumulativeSum()
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::ComputeCumulativeSum |
( |
std::vector< ArcIndexType > * |
v | ) |
|
|
protectedinherited |
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.
◆ FreezeCapacities()
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::FreezeCapacities |
( |
| ) |
|
|
inherited |
FreezeCapacities() makes any future attempt to change the graph capacities crash in DEBUG mode.
- Todo:
- (user): Only define this in debug mode at the cost of having a lot of ifndef NDEBUG all over the place? remove the function completely ?
Definition at line 966 of file graph.h.
◆ GroupForwardArcsByFunctor()
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::GroupForwardArcsByFunctor |
( |
const A & |
a, |
|
|
B * |
b |
|
) |
| |
|
inlineinherited |
- 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.
◆ Head()
template<typename NodeIndexType , typename ArcIndexType >
| NodeIndexType util::CompleteGraph< NodeIndexType, ArcIndexType >::Head |
( |
ArcIndexType |
arc | ) |
const |
◆ IsArcValid()
| bool util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::IsArcValid |
( |
ArcIndexType |
arc | ) |
const |
|
inlineinherited |
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 219 of file graph.h.
◆ IsNodeValid()
| bool util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::IsNodeValid |
( |
NodeIndexType |
node | ) |
const |
|
inlineinherited |
Returns true if the given node is a valid node of the graph.
Definition at line 213 of file graph.h.
◆ max_end_arc_index()
| ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::max_end_arc_index |
( |
| ) |
const |
|
inlineinherited |
◆ node_capacity()
| NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::node_capacity |
( |
| ) |
const |
|
inherited |
Capacity reserved for future nodes, always >= num_nodes_.
- Todo:
- (user): Is it needed? remove completely? return the real capacities at the cost of having a different implementation for each graphs?
Definition at line 951 of file graph.h.
◆ num_arcs()
| ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::num_arcs |
( |
| ) |
const |
|
inlineinherited |
Returns the number of valid arcs in the graph.
Definition at line 204 of file graph.h.
◆ num_nodes()
| NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::num_nodes |
( |
| ) |
const |
|
inlineinherited |
Returns the number of valid nodes in the graph.
Definition at line 201 of file graph.h.
◆ operator[]()
template<typename NodeIndexType , typename ArcIndexType >
| IntegerRange< NodeIndexType > util::CompleteGraph< NodeIndexType, ArcIndexType >::operator[] |
( |
NodeIndexType |
node | ) |
const |
◆ OutDegree()
template<typename NodeIndexType , typename ArcIndexType >
| ArcIndexType util::CompleteGraph< NodeIndexType, ArcIndexType >::OutDegree |
( |
NodeIndexType |
node | ) |
const |
◆ OutgoingArcs()
template<typename NodeIndexType , typename ArcIndexType >
| IntegerRange< ArcIndexType > util::CompleteGraph< NodeIndexType, ArcIndexType >::OutgoingArcs |
( |
NodeIndexType |
node | ) |
const |
◆ OutgoingArcsStartingFrom()
template<typename NodeIndexType , typename ArcIndexType >
| IntegerRange< ArcIndexType > util::CompleteGraph< NodeIndexType, ArcIndexType >::OutgoingArcsStartingFrom |
( |
NodeIndexType |
node, |
|
|
ArcIndexType |
from |
|
) |
| const |
◆ Reserve()
| void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::Reserve |
( |
NodeIndexType |
node_capacity, |
|
|
ArcIndexType |
arc_capacity |
|
) |
| |
|
inlineinherited |
◆ ReserveArcs()
| virtual void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::ReserveArcs |
( |
ArcIndexType |
bound | ) |
|
|
inlinevirtualinherited |
◆ ReserveNodes()
| virtual void util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::ReserveNodes |
( |
NodeIndexType |
bound | ) |
|
|
inlinevirtualinherited |
◆ Tail()
template<typename NodeIndexType , typename ArcIndexType >
| NodeIndexType util::CompleteGraph< NodeIndexType, ArcIndexType >::Tail |
( |
ArcIndexType |
arc | ) |
const |
◆ arc_capacity_
| ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::arc_capacity_ |
|
protectedinherited |
◆ const_capacities_
| bool util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::const_capacities_ |
|
protectedinherited |
◆ kNilArc
| const ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::kNilArc |
|
staticinherited |
◆ kNilNode
| const NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::kNilNode |
|
staticinherited |
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.
◆ node_capacity_
| NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::node_capacity_ |
|
protectedinherited |
◆ num_arcs_
| ArcIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::num_arcs_ |
|
protectedinherited |
◆ num_nodes_
| NodeIndexType util::BaseGraph< NodeIndexType, ArcIndexType, HasReverseArcs >::num_nodes_ |
|
protectedinherited |
The documentation for this class was generated from the following file: