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.
FORCEINLINE NodeID GetNode () const
 get the node this leg passes.
FORCEINLINE NodeID GetOrigin () const
 get the overall origin of the path.
FORCEINLINE PathGetParent ()
 get the parent leg of this one.
FORCEINLINE uint GetCapacity () const
 get the overall capacity of the path.
FORCEINLINE int GetFreeCapacity () const
 get the free capacity of the path.
FORCEINLINE 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)
FORCEINLINE uint GetDistance () const
 get the overall distance of the path.
FORCEINLINE void ReduceFlow (uint f)
 reduce the flow on this leg only by the specified amount.
FORCEINLINE void AddFlow (uint f)
 increase the flow on this leg only by the specified amount.
FORCEINLINE uint GetFlow () const
 get the flow on this leg.
FORCEINLINE uint GetNumChildren () const
 get the number of "forked off" child legs of this one
FORCEINLINE void UnFork ()
 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
 this is the flow the current run of the mcf solver assigns
NodeID node
 the link graph node this leg passes
NodeID origin
 the link graph node this path originates from
uint num_children
 the number of child legs that have been forked from this path
Pathparent
 the 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 281 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 490 of file linkgraph.cpp.


Member Function Documentation

FORCEINLINE 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 463 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 441 of file linkgraph.cpp.

References capacity, distance, free_capacity, min(), num_children, origin, parent, and UnFork().

FORCEINLINE uint Path::GetCapacity (  )  const [inline]

get the overall capacity of the path.

Definition at line 295 of file linkgraph.h.

References capacity.

FORCEINLINE uint Path::GetDistance (  )  const [inline]

get the overall distance of the path.

Definition at line 306 of file linkgraph.h.

References distance.

FORCEINLINE 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().

FORCEINLINE int Path::GetFreeCapacity (  )  const [inline]

get the free capacity of the path.

Definition at line 298 of file linkgraph.h.

References free_capacity.

Referenced by MCF1stPass::MCF1stPass(), and MCF2ndPass::MCF2ndPass().

FORCEINLINE NodeID Path::GetNode (  )  const [inline]
FORCEINLINE NodeID Path::GetOrigin (  )  const [inline]

get the overall origin of the path.

Definition at line 289 of file linkgraph.h.

References origin.

Referenced by MCF1stPass::EliminateCycles(), and FlowMapper::Run().

FORCEINLINE Path* Path::GetParent (  )  [inline]

get the parent leg of this one.

Definition at line 292 of file linkgraph.h.

References parent.

Referenced by MultiCommodityFlow::CleanupPaths().

FORCEINLINE 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: