Public Member Functions | Protected Attributes

# Path Class Reference

A leg of a path in the link graph. More...

`#include <linkgraph.h>`

Inheritance diagram for Path:

## 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.

## Detailed Description

A leg of a path in the link graph.

Paths can form trees by being "forked".

Definition at line 280 of file linkgraph.h.

## Constructor & Destructor Documentation

Path::Path | ( | NodeID | n,
|  | bool | source = `false` |
| ) |  |  |

create a leg of a path in the link graph.

Parameters:

  | n | id of the link graph node this path passes
  | source | if true, this is the first leg of the path

Definition at line 463 of file linkgraph.cpp.

## Member Function Documentation

void Path::AddFlow | ( | uint | f | ) | `[inline]`

Increase the flow on this leg only by the specified amount.

Definition at line 312 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.

Parameters:

  | 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

Returns:
  the amount of flow actually pushed

Definition at line 436 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.

Parameters:

  | base | the path to fork from
  | cap | maximum capacity of the new path
  | dist | distance of the new leg

Definition at line 414 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 294 of file linkgraph.h.

References capacity.

uint Path::GetDistance | ( |  | ) | const`[inline]`

Get the overall distance of the path.

Definition at line 306 of file linkgraph.h.

References distance.

uint Path::GetFlow | ( |  | ) | const`[inline]`

Get the flow on this leg.

Definition at line 315 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 297 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 285 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 318 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 288 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 291 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 309 of file linkgraph.h.

References flow.

Referenced by MCF1stPass::EliminateCycle(), and MCF1stPass::EliminateCycles().

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

- src/linkgraph/linkgraph.h
- src/linkgraph/linkgraph.cpp