org.graffiti.plugins.algorithms.fordfulkerson
Class FordFulkersonAlgorithm

java.lang.Object
  extended by org.graffiti.plugin.AbstractParametrizable
      extended by org.graffiti.plugin.algorithm.AbstractAlgorithm
          extended by org.graffiti.plugins.algorithms.fordfulkerson.FordFulkersonAlgorithm
All Implemented Interfaces:
Algorithm, Parametrizable

public class FordFulkersonAlgorithm
extends AbstractAlgorithm

This is an implementation of ford fulkerson algorithm with the method of J.Edmonds and R. Karp, which takes into account the shortest augmenting path for calculation of the network flow.

Version:
$Revision: 5766 $

Field Summary
 String capacity
          The id of label attribute "capacity" for edges.
static int EDGE_NAME_PARAM
           
static String FLOW
          The id for the new label attributes on edges which arrise as result of this algorithm
static int NODE_NAME_PARAM
           
 String nodesLabelPath
          The expected path of node label attribute.
static int ONLY_SELECTION_PARAM
          The position of "only selection parameter" in the parameter array.
static int SELECTION_PARAM
          The position of "selection parameter" in the parameter array.
static int SINK_PARAM
          The position of "sink node parameter" in the parameter array.
static int SOURCE_PARAM
          The position of "source node parameter" in the parameter array.
 
Constructor Summary
FordFulkersonAlgorithm()
          Constructs a new instance.
 
Method Summary
 void attach(Graph g)
          Attaches the given graph to this algorithm.
 void check()
          Checks whether all preconditions of the current graph are satisfied.
 void execute()
          Executes the whole algorithm.
 Parameter<?>[] getAlgorithmParameters()
           
 String getName()
          Returns the name (id) of this Parametrizable.
 int getNetworkFlow()
          Retutns the value of the total network flow.
 void reset()
          Resets the internal state of the algorithm.
 void setAlgorithmParameters(Parameter<?>[] params)
           
 void setEdgesCollection(Collection<Edge> edges)
          Sets the new edges collection.
 void setNodesCollection(Collection<Node> nodes)
          Sets the new nodes collection.
 void setSinkNode(Node sinkNode)
          Sets the sink node to the given value.
 void setSourceNode(Node sourceNode)
          Sets the source node to the given value.
 
Methods inherited from class org.graffiti.plugin.algorithm.AbstractAlgorithm
getAnimation, supportsAnimation
 
Methods inherited from class org.graffiti.plugin.AbstractParametrizable
copyParameters, getDefaultParameters, getParameters, getUserParameters, saveUserParameters, saveUserParameters, setParameters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graffiti.plugin.Parametrizable
getDefaultParameters, getParameters, setParameters
 

Field Detail

capacity

public String capacity
The id of label attribute "capacity" for edges.


FLOW

public static final String FLOW
The id for the new label attributes on edges which arrise as result of this algorithm

See Also:
Constant Field Values

nodesLabelPath

public String nodesLabelPath
The expected path of node label attribute.


ONLY_SELECTION_PARAM

public static final int ONLY_SELECTION_PARAM
The position of "only selection parameter" in the parameter array.

See Also:
Constant Field Values

SELECTION_PARAM

public static final int SELECTION_PARAM
The position of "selection parameter" in the parameter array.

See Also:
Constant Field Values

SINK_PARAM

public static final int SINK_PARAM
The position of "sink node parameter" in the parameter array.

See Also:
Constant Field Values

SOURCE_PARAM

public static final int SOURCE_PARAM
The position of "source node parameter" in the parameter array.

See Also:
Constant Field Values

NODE_NAME_PARAM

public static final int NODE_NAME_PARAM
See Also:
Constant Field Values

EDGE_NAME_PARAM

public static final int EDGE_NAME_PARAM
See Also:
Constant Field Values
Constructor Detail

FordFulkersonAlgorithm

public FordFulkersonAlgorithm()
Constructs a new instance.

Method Detail

setEdgesCollection

public void setEdgesCollection(Collection<Edge> edges)
Sets the new edges collection.

Parameters:
edges - edges collection to be set.

getName

public String getName()
Description copied from interface: org.graffiti.plugin.Parametrizable
Returns the name (id) of this Parametrizable.

Returns:
DOCUMENT ME!
See Also:
Parametrizable.getName()

getNetworkFlow

public int getNetworkFlow()
Retutns the value of the total network flow.

Returns:
the value of the total network flow.

setNodesCollection

public void setNodesCollection(Collection<Node> nodes)
Sets the new nodes collection.

Parameters:
nodes - nodes collection to be set.

setAlgorithmParameters

public void setAlgorithmParameters(Parameter<?>[] params)
Overrides:
setAlgorithmParameters in class AbstractParametrizable
See Also:
AbstractParametrizable.setAlgorithmParameters(Parameter[])

getAlgorithmParameters

public Parameter<?>[] getAlgorithmParameters()
Overrides:
getAlgorithmParameters in class AbstractParametrizable

setSinkNode

public void setSinkNode(Node sinkNode)
Sets the sink node to the given value.

Parameters:
sinkNode - the new sink node.

setSourceNode

public void setSourceNode(Node sourceNode)
Sets the source node to the given value.

Parameters:
sourceNode - the new source node.

attach

public void attach(Graph g)
Description copied from interface: org.graffiti.plugin.algorithm.Algorithm
Attaches the given graph to this algorithm.

Specified by:
attach in interface Algorithm
Overrides:
attach in class AbstractAlgorithm
Parameters:
g - the graph to attach.
See Also:
Algorithm.attach(org.graffiti.graph.Graph)

check

public void check()
           throws PreconditionException
Description copied from interface: org.graffiti.plugin.algorithm.Algorithm
Checks whether all preconditions of the current graph are satisfied.

Specified by:
check in interface Algorithm
Overrides:
check in class AbstractAlgorithm
Throws:
PreconditionException - if the preconditions of the current graph are not satisfied.
See Also:
Algorithm.check()

execute

public void execute()
Description copied from interface: org.graffiti.plugin.algorithm.Algorithm
Executes the whole algorithm.

See Also:
Algorithm.execute()

reset

public void reset()
Description copied from interface: org.graffiti.plugin.algorithm.Algorithm
Resets the internal state of the algorithm.

Specified by:
reset in interface Algorithm
Overrides:
reset in class AbstractAlgorithm
See Also:
Algorithm.reset()


Generated at 2012-05-30 11:01:25 PM CEST