org.graphstream.algorithm.flow
Interface FlowAlgorithm

All Superinterfaces:
Algorithm
All Known Implementing Classes:
EdmondsKarpAlgorithm, FlowAlgorithmBase, FordFulkersonAlgorithm

public interface FlowAlgorithm
extends Algorithm

Defines algorithm used to compute maximum flow.


Method Summary
 double getCapacity(org.graphstream.graph.Node u, org.graphstream.graph.Node v)
          Get capacity of edge (u,v).
 String getCapacityAttribute()
          Get the key attribute from which capacities are loaded.
 double getFlow(org.graphstream.graph.Node u, org.graphstream.graph.Node v)
          Get flow value of edge (u,v).
 String getFlowSinkId()
          Get id of the sink.
 String getFlowSourceId()
          Get id of the source.
 double getMaximumFlow()
          Get maximum flow compute by Algorithm.compute().
 void init(org.graphstream.graph.Graph g, String sourceId, String sinkId)
          Init the algorithm.
 void setCapacity(org.graphstream.graph.Node u, org.graphstream.graph.Node v, double capacity)
          Set capacity of (u,v).
 void setCapacityAttribute(String attribute)
          Set the key of the attribute from which capacities will be loaded.
 void setFlow(org.graphstream.graph.Node u, org.graphstream.graph.Node v, double flow)
          Set flow of edge (u,v).
 
Methods inherited from interface org.graphstream.algorithm.Algorithm
compute, init
 

Method Detail

getFlow

double getFlow(org.graphstream.graph.Node u,
               org.graphstream.graph.Node v)
Get flow value of edge (u,v).

Parameters:
u -
v -
Returns:
flow of (u,v)

setFlow

void setFlow(org.graphstream.graph.Node u,
             org.graphstream.graph.Node v,
             double flow)
Set flow of edge (u,v).

Parameters:
u -
v -
flow - new flow

getCapacity

double getCapacity(org.graphstream.graph.Node u,
                   org.graphstream.graph.Node v)
Get capacity of edge (u,v).

Parameters:
u -
v -
Returns:
capacity of (u,v)s

setCapacity

void setCapacity(org.graphstream.graph.Node u,
                 org.graphstream.graph.Node v,
                 double capacity)
Set capacity of (u,v). Capacities should be set between calls to init(Graph, String, String) and Algorithm.compute().

Parameters:
u -
v -
capacity - new capacity of (u,v)

setCapacityAttribute

void setCapacityAttribute(String attribute)
Set the key of the attribute from which capacities will be loaded. Attribute values of edge (u,v) should be an array of double where first element is the value of the capacity of (u,v) and second the capacity of (v,u). If there is only one value, the value of (v,u) will be zero. If no value is available, both capacities will be zero. If capacity attribute is null, you have to set capacities before calling Algorithm.compute().

Parameters:
attribute -

getCapacityAttribute

String getCapacityAttribute()
Get the key attribute from which capacities are loaded.

Returns:
key attribute of capacities
See Also:
setCapacityAttribute(String)

getMaximumFlow

double getMaximumFlow()
Get maximum flow compute by Algorithm.compute().

Returns:
maximum flow

getFlowSourceId

String getFlowSourceId()
Get id of the source.

Returns:
id of the source

getFlowSinkId

String getFlowSinkId()
Get id of the sink.

Returns:
id of the sink

init

void init(org.graphstream.graph.Graph g,
          String sourceId,
          String sinkId)
Init the algorithm. This method replaces the Algorithm.init(Graph) method of Algorithm so users just have to call this new method.

Parameters:
g - graph that should be used by the algorithm
sourceId - id of the source of the flow
sinkId - id of the sink of the flow


Copyright © 2013. All Rights Reserved.