Public Member Functions | Static 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:
CapacityAnnotation DistanceAnnotation

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.
PathGetParent ()
 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 capacity ratio of this path.
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.

Static Public Member Functions

static int GetCapacityRatio (int free, int total)
 Get ratio of free * 16 (so that we get fewer 0) / total capacity + 1 (so that we don't divide by 0).

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.
Pathparent
 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 282 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 479 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 329 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 Link graph component this node belongs to.
only_positive If true, don't push more flow than there is capacity.
Returns:
Amount of flow actually pushed.

Definition at line 452 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 Path to fork from.
cap Maximum capacity of the new leg.
free_cap Remaining free capacity of the new leg.
dist Distance of the new leg.

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

static int Path::GetCapacityRatio ( int  free,
int  total 
) [inline, static]

Get ratio of free * 16 (so that we get fewer 0) / total capacity + 1 (so that we don't divide by 0).

Parameters:
free Free capacity.
total Total capacity.
Returns:
free * 16 / (total + 1).

Definition at line 308 of file linkgraph.h.

int Path::GetCapacityRatio (  )  const [inline]

Get capacity ratio of this path.

Returns:
free capacity * 16 / (total capacity + 1).

Definition at line 317 of file linkgraph.h.

References capacity, and free_capacity.

Referenced by CapacityAnnotation::GetAnnotation(), and CapacityAnnotation::IsBetter().

uint Path::GetDistance (  )  const [inline]

Get the overall distance of the path.

Definition at line 323 of file linkgraph.h.

References distance.

uint Path::GetFlow (  )  const [inline]

Get the flow on this leg.

Definition at line 332 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]
uint Path::GetNumChildren (  )  const [inline]

Get the number of "forked off" child legs of this one.

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

References flow.

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


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