A leg of a path in the link graph. More...
#include <linkgraph.h>
Public Member Functions | |
Path (NodeID n, bool source=false) | |
create a leg of a path in the link graph. | |
NodeID | GetNode () const |
Get the node this leg passes. | |
NodeID | GetOrigin () const |
Get the overall origin of the path. | |
Path * | GetParent () |
Get the parent leg of this one. | |
uint | GetCapacity () const |
Get the overall capacity of the path. | |
int | GetFreeCapacity () const |
Get the free capacity of the path. | |
int | GetCapacityRatio () const |
Get ratio of free * 16 (so that we get fewer 0) / overall capacity + 1 (so that we don't divide by 0). | |
uint | GetDistance () const |
Get the overall distance of the path. | |
void | ReduceFlow (uint f) |
Reduce the flow on this leg only by the specified amount. | |
void | AddFlow (uint f) |
Increase the flow on this leg only by the specified amount. | |
uint | GetFlow () const |
Get the flow on this leg. | |
uint | GetNumChildren () const |
Get the number of "forked off" child legs of this one. | |
void | Detach () |
Detach this path from its parent. | |
uint | AddFlow (uint f, LinkGraphComponent *graph, bool only_positive) |
Push some flow along a path and register the path in the nodes it passes if successful. | |
void | Fork (Path *base, uint cap, int free_cap, uint dist) |
Add this path as a new child to the given base path, thus making this path a "fork" of the base path. | |
Protected Attributes | |
uint | distance |
Sum(distance of all legs up to this one). | |
uint | capacity |
This capacity is min(capacity) fom all edges. | |
int | free_capacity |
This capacity is min(edge.capacity - edge.flow) for the current run of Dijkstra. | |
uint | flow |
Flow the current run of the mcf solver assigns. | |
NodeID | node |
Link graph node this leg passes. | |
NodeID | origin |
Link graph node this path originates from. | |
uint | num_children |
Number of child legs that have been forked from this path. | |
Path * | parent |
Parent leg of this one. |
A leg of a path in the link graph.
Paths can form trees by being "forked".
Definition at line 282 of file linkgraph.h.
Path::Path | ( | NodeID | n, | |
bool | source = false | |||
) |
create a leg of a path in the link graph.
n | id of the link graph node this path passes | |
source | if true, this is the first leg of the path |
Definition at line 460 of file linkgraph.cpp.
void Path::AddFlow | ( | uint | f | ) | [inline] |
Increase the flow on this leg only by the specified amount.
Definition at line 314 of file linkgraph.h.
References flow.
Referenced by AddFlow(), MCF1stPass::EliminateCycles(), and MultiCommodityFlow::PushFlow().
uint Path::AddFlow | ( | uint | new_flow, | |
LinkGraphComponent * | graph, | |||
bool | only_positive | |||
) |
Push some flow along a path and register the path in the nodes it passes if successful.
new_flow | amount of flow to push | |
graph | the link graph component this node belongs to | |
only_positive | if true, don't push more flow than there is capacity |
Definition at line 433 of file linkgraph.cpp.
References AddFlow(), Edge::capacity, flow, Edge::flow, LinkGraphComponent::GetEdge(), LinkGraphComponent::GetNode(), LinkGraphComponent::GetSettings(), min(), node, parent, Node::paths, and LinkGraphSettings::short_path_saturation.
void Path::Fork | ( | Path * | base, | |
uint | cap, | |||
int | free_cap, | |||
uint | dist | |||
) |
Add this path as a new child to the given base path, thus making this path a "fork" of the base path.
base | the path to fork from | |
cap | maximum capacity of the new path | |
dist | distance of the new leg |
Definition at line 411 of file linkgraph.cpp.
References capacity, Detach(), distance, free_capacity, min(), num_children, origin, and parent.
uint Path::GetCapacity | ( | ) | const [inline] |
Get the overall capacity of the path.
Definition at line 296 of file linkgraph.h.
References capacity.
uint Path::GetDistance | ( | ) | const [inline] |
Get the overall distance of the path.
Definition at line 308 of file linkgraph.h.
References distance.
uint Path::GetFlow | ( | ) | const [inline] |
Get the flow on this leg.
Definition at line 317 of file linkgraph.h.
References flow.
Referenced by MultiCommodityFlow::CleanupPaths(), MCF1stPass::EliminateCycles(), MCF1stPass::FindCycleFlow(), and FlowMapper::Run().
int Path::GetFreeCapacity | ( | ) | const [inline] |
Get the free capacity of the path.
Definition at line 299 of file linkgraph.h.
References free_capacity.
Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().
NodeID Path::GetNode | ( | ) | const [inline] |
Get the node this leg passes.
Definition at line 287 of file linkgraph.h.
References node.
Referenced by MultiCommodityFlow::CleanupPaths(), MCF1stPass::EliminateCycle(), MCF1stPass::EliminateCycles(), DistanceAnnotation::Comparator::operator()(), CapacityAnnotation::Comparator::operator()(), and FlowMapper::Run().
uint Path::GetNumChildren | ( | ) | const [inline] |
Get the number of "forked off" child legs of this one.
Definition at line 320 of file linkgraph.h.
References num_children.
Referenced by MultiCommodityFlow::CleanupPaths().
NodeID Path::GetOrigin | ( | ) | const [inline] |
Get the overall origin of the path.
Definition at line 290 of file linkgraph.h.
References origin.
Referenced by MCF1stPass::EliminateCycles(), and FlowMapper::Run().
Path* Path::GetParent | ( | ) | [inline] |
Get the parent leg of this one.
Definition at line 293 of file linkgraph.h.
References parent.
Referenced by MultiCommodityFlow::CleanupPaths().
void Path::ReduceFlow | ( | uint | f | ) | [inline] |
Reduce the flow on this leg only by the specified amount.
Definition at line 311 of file linkgraph.h.
References flow.
Referenced by MCF1stPass::EliminateCycle(), and MCF1stPass::EliminateCycles().