org.graphstream.algorithm.flow
Class FlowAlgorithmBase

java.lang.Object
  extended by org.graphstream.algorithm.flow.FlowAlgorithmBase
All Implemented Interfaces:
Algorithm, FlowAlgorithm
Direct Known Subclasses:
FordFulkersonAlgorithm

public abstract class FlowAlgorithmBase
extends Object
implements FlowAlgorithm

Base for flow algorithms. Provides features to handle capacities and flows.


Method Summary
 double getCapacity(int uIndex, int vIndex)
          Shortcut getCapacity(Node, Node).
 double getCapacity(org.graphstream.graph.Node u, org.graphstream.graph.Node v)
          Get capacity of edge (u,v).
 double getCapacity(String uId, String vId)
          Shortcut getCapacity(Node, Node).
 String getCapacityAttribute()
          Get the key attribute from which capacities are loaded.
 double getFlow(int uIndex, int vIndex)
          Shortcut to getFlow(Node, Node).
 double getFlow(org.graphstream.graph.Node u, org.graphstream.graph.Node v)
          Get flow value of edge (u,v).
 double getFlow(String uId, String vId)
          Shortcut to getFlow(Node, Node).
 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 graph)
          Initialization of the algorithm.
 void init(org.graphstream.graph.Graph g, String sourceId, String sinkId)
          Init the algorithm.
 void setAllCapacities(double value)
           
 void setCapacity(int uIndex, int vIndex, double capacity)
          Shortcut to setCapacity(Node, Node, double).
 void setCapacity(org.graphstream.graph.Node u, org.graphstream.graph.Node v, double capacity)
          Set capacity of (u,v).
 void setCapacity(String uId, String vId, double capacity)
          Shortcut to setCapacity(Node, Node, double).
 void setCapacityAttribute(String attribute)
          Set the key of the attribute from which capacities will be loaded.
 void setFlow(int uIndex, int vIndex, double flow)
          Shortcut to setFlow(Node, Node, double).
 void setFlow(org.graphstream.graph.Node u, org.graphstream.graph.Node v, double flow)
          Set flow of edge (u,v).
 void setFlow(String uId, String vId, double flow)
          Shortcut to setFlow(Node, Node, double).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graphstream.algorithm.Algorithm
compute
 

Method Detail

getFlowSourceId

public String getFlowSourceId()
Description copied from interface: FlowAlgorithm
Get id of the source.

Specified by:
getFlowSourceId in interface FlowAlgorithm
Returns:
id of the source

getFlowSinkId

public String getFlowSinkId()
Description copied from interface: FlowAlgorithm
Get id of the sink.

Specified by:
getFlowSinkId in interface FlowAlgorithm
Returns:
id of the sink

init

public void init(org.graphstream.graph.Graph graph)
Description copied from interface: Algorithm
Initialization of the algorithm. This method has to be called before the Algorithm.compute() method to initialize or reset the algorithm according to the new given graph.

Specified by:
init in interface Algorithm
Parameters:
graph - The graph this algorithm is using.

init

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

Specified by:
init in interface FlowAlgorithm
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

getMaximumFlow

public double getMaximumFlow()
Description copied from interface: FlowAlgorithm
Get maximum flow compute by Algorithm.compute().

Specified by:
getMaximumFlow in interface FlowAlgorithm
Returns:
maximum flow

getFlow

public double getFlow(int uIndex,
                      int vIndex)
Shortcut to getFlow(Node, Node).

Parameters:
uIndex - index of source
vIndex - index of target
Returns:
flow of (u,v)

getFlow

public double getFlow(String uId,
                      String vId)
Shortcut to getFlow(Node, Node).

Parameters:
uId - id of source
vId - id of target
Returns:
flow of (u,v)

getFlow

public double getFlow(org.graphstream.graph.Node u,
                      org.graphstream.graph.Node v)
Description copied from interface: FlowAlgorithm
Get flow value of edge (u,v).

Specified by:
getFlow in interface FlowAlgorithm
Returns:
flow of (u,v)

setFlow

public void setFlow(int uIndex,
                    int vIndex,
                    double flow)
Shortcut to setFlow(Node, Node, double).

Parameters:
uIndex - index of u
vIndex - index of v
flow - new float of (u,v)

setFlow

public void setFlow(String uId,
                    String vId,
                    double flow)
Shortcut to setFlow(Node, Node, double).

Parameters:
uId - id of u
vId - id of v
flow - new float of (u,v)

setFlow

public void setFlow(org.graphstream.graph.Node u,
                    org.graphstream.graph.Node v,
                    double flow)
Description copied from interface: FlowAlgorithm
Set flow of edge (u,v).

Specified by:
setFlow in interface FlowAlgorithm
flow - new flow

getCapacity

public double getCapacity(int uIndex,
                          int vIndex)
Shortcut getCapacity(Node, Node).

Parameters:
uIndex - index of u
vIndex - index of v
Returns:
capacity of (u,v).

getCapacity

public double getCapacity(String uId,
                          String vId)
Shortcut getCapacity(Node, Node).

Parameters:
uId - id of u
vId - id of v
Returns:
capacity of (u,v).

getCapacity

public double getCapacity(org.graphstream.graph.Node u,
                          org.graphstream.graph.Node v)
Description copied from interface: FlowAlgorithm
Get capacity of edge (u,v).

Specified by:
getCapacity in interface FlowAlgorithm
Returns:
capacity of (u,v)s

setCapacity

public void setCapacity(int uIndex,
                        int vIndex,
                        double capacity)
Shortcut to setCapacity(Node, Node, double).

Parameters:
uIndex - index of u
vIndex - index of v
capacity - new capacity of (u,v)

setCapacity

public void setCapacity(String uId,
                        String vId,
                        double capacity)
Shortcut to setCapacity(Node, Node, double).

Parameters:
uId - id of u
vId - id of v
capacity - new capacity of (u,v)

setCapacity

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

Specified by:
setCapacity in interface FlowAlgorithm
capacity - new capacity of (u,v)

setCapacityAttribute

public void setCapacityAttribute(String attribute)
Description copied from interface: FlowAlgorithm
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().

Specified by:
setCapacityAttribute in interface FlowAlgorithm

getCapacityAttribute

public String getCapacityAttribute()
Description copied from interface: FlowAlgorithm
Get the key attribute from which capacities are loaded.

Specified by:
getCapacityAttribute in interface FlowAlgorithm
Returns:
key attribute of capacities
See Also:
FlowAlgorithm.setCapacityAttribute(String)

setAllCapacities

public void setAllCapacities(double value)


Copyright © 2013. All Rights Reserved.