Public Member Functions | Private Member Functions

MCF1stPass Class Reference

First pass of the MCF calculation. More...

#include <mcf.h>

Inheritance diagram for MCF1stPass:
MultiCommodityFlow

Public Member Functions

 MCF1stPass (LinkGraphComponent *graph)
 Run the first pass of the MCF calculation.

Private Member Functions

bool EliminateCycles ()
 Eliminate all cycles in the graph.
bool EliminateCycles (PathVector &path, NodeID origin_id, NodeID next_id)
 Eliminate cycles for origin_id in the graph.
void EliminateCycle (PathVector &path, Path *cycle_begin, uint flow)
 Eliminate a cycle of the given flow in the given set of paths.
uint FindCycleFlow (const PathVector &path, const Path *cycle_begin)
 Find the flow along a cycle including cycle_begin in path.

Detailed Description

First pass of the MCF calculation.

Saturates shortest paths first, creates new paths if needed, eliminates cycles. This calculation is of exponential complexity in the number of nodes but the constant factors are sufficiently small to make it usable for most real-life link graph components. You can deal with performance problems that might occur here in multiple ways:

Definition at line 97 of file mcf.h.


Constructor & Destructor Documentation


Member Function Documentation

void MCF1stPass::EliminateCycle ( PathVector &  path,
Path cycle_begin,
uint  flow 
) [private]

Eliminate a cycle of the given flow in the given set of paths.

Parameters:
path the set of paths containing the cycle
cycle_begin a part the cycle to start at
flow the flow along the cycle

Definition at line 204 of file mcf.cpp.

References Edge::flow, LinkGraphComponent::GetEdge(), Path::GetNode(), MultiCommodityFlow::graph, and Path::ReduceFlow().

Referenced by EliminateCycles().

bool MCF1stPass::EliminateCycles ( PathVector &  path,
NodeID  origin_id,
NodeID  next_id 
) [private]

Eliminate cycles for origin_id in the graph.

Start searching at next_id and work recursively. Also "summarize" paths: Add up the flows along parallel paths in one.

Parameters:
path the paths checked in parent calls to this method
origin_id the origin of the paths to be checked
next_id the next node to be checked
Returns:
if any cycles have been found and eliminated

Definition at line 225 of file mcf.cpp.

References Path::AddFlow(), EliminateCycle(), EliminateCycles(), FindCycleFlow(), Path::GetFlow(), Path::GetNode(), LinkGraphComponent::GetNode(), Path::GetOrigin(), MultiCommodityFlow::graph, Node::paths, and Path::ReduceFlow().

bool MCF1stPass::EliminateCycles (  )  [private]

Eliminate all cycles in the graph.

Check paths starting at each node for potential cycles.

Returns:
if any cycles have been found and eliminated.

Definition at line 292 of file mcf.cpp.

References LinkGraphComponent::GetSize(), and MultiCommodityFlow::graph.

Referenced by EliminateCycles(), and MCF1stPass().

uint MCF1stPass::FindCycleFlow ( const PathVector &  path,
const Path cycle_begin 
) [private]

Find the flow along a cycle including cycle_begin in path.

Parameters:
path the set of paths that form the cycle
cycle_begin the path to start at
Returns:
the flow along the cycle

Definition at line 187 of file mcf.cpp.

References Path::GetFlow(), and min().

Referenced by EliminateCycles().


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