de.fhstralsund.vinets.algorithm
Class LargeCycleFinder

java.lang.Object
  extended by de.fhstralsund.vinets.algorithm.dfs.DFSAdapter
      extended by de.fhstralsund.vinets.algorithm.LargeCycleFinder
All Implemented Interfaces:
Algorithm, de.fhstralsund.vinets.algorithm.dfs.DFSListener

public class LargeCycleFinder
extends de.fhstralsund.vinets.algorithm.dfs.DFSAdapter
implements Algorithm

Finds a large cycle in the graph using DFS. The cycle consists of some tree edges plus ONE back edge. Therefore the cycle is probably NOT the largest cycle in the graph.


Constructor Summary
LargeCycleFinder()
           
 
Method Summary
 boolean accept(Parameter params)
          Checks whether the passed Parameter is appropriate as input for this Algorithm.
 void discoveredNode(Node node, Node parent, int timestamp)
           
 Parameter execute(Parameter params)
          Examines the Graph passed within the Parameter object.
 void foundEdge(Edge edge, Node from, java.lang.Object edgetype)
           
 java.lang.String getHint()
          Delivers a short help text explaining the features of this Algorithm.
 java.lang.String getName()
          Delivers a text for the button linked to this Algorithm.
 java.util.Iterator largestCycleEdges()
          Returns an Iterator over the edges forming the largest cycle found.
 java.util.Iterator largestCycleElements()
          Returns an Iterator over the nodes and edges forming the largest cycle found.
 int largestCycleLength()
          Returns the length of the largest cycle found.
 java.util.Iterator largestCycleNodes()
          Returns an Iterator over the nodes forming the largest cycle found.
 
Methods inherited from class de.fhstralsund.vinets.algorithm.dfs.DFSAdapter
beginConnectedComponent, finishDFS, finishedNode, startDFS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LargeCycleFinder

public LargeCycleFinder()
Method Detail

accept

public boolean accept(Parameter params)
Description copied from interface: Algorithm
Checks whether the passed Parameter is appropriate as input for this Algorithm. Usually, implementations check the graph type for applicability of this Algorithm. If the Parameter is rejected and false is returned, the Parameter message should be set to a String describing the cause for the failing.

Specified by:
accept in interface Algorithm
Parameters:
params - a Parameter object containing the input Graph and possible additional input values.
Returns:
true if this Parameter is a feasible input.

getHint

public java.lang.String getHint()
Description copied from interface: Algorithm
Delivers a short help text explaining the features of this Algorithm.

Specified by:
getHint in interface Algorithm
Returns:
the hint.

getName

public java.lang.String getName()
Description copied from interface: Algorithm
Delivers a text for the button linked to this Algorithm.

Specified by:
getName in interface Algorithm
Returns:
the button text.

execute

public Parameter execute(Parameter params)
Description copied from interface: Algorithm
Examines the Graph passed within the Parameter object. An implementing method may determine a certain graph property or change the structure, geometry or representation of the Graph and/or its elements. Please notice, that any Algorithm may be invoked multiple times, therefore the required initialization should be called at the beginning of this method.

Specified by:
execute in interface Algorithm
Parameters:
params - a Parameter encapsulating a Graph and (optionally) a String and additional properties.
Returns:
a Parameter encapsulating the manipulated graph and (optionally) a result String and additional properties.
See Also:
Parameter

discoveredNode

public void discoveredNode(Node node,
                           Node parent,
                           int timestamp)
Specified by:
discoveredNode in interface de.fhstralsund.vinets.algorithm.dfs.DFSListener
Overrides:
discoveredNode in class de.fhstralsund.vinets.algorithm.dfs.DFSAdapter

foundEdge

public void foundEdge(Edge edge,
                      Node from,
                      java.lang.Object edgetype)
Specified by:
foundEdge in interface de.fhstralsund.vinets.algorithm.dfs.DFSListener
Overrides:
foundEdge in class de.fhstralsund.vinets.algorithm.dfs.DFSAdapter

largestCycleElements

public java.util.Iterator largestCycleElements()
Returns an Iterator over the nodes and edges forming the largest cycle found.

Returns:
the Iterator.

largestCycleNodes

public java.util.Iterator largestCycleNodes()
Returns an Iterator over the nodes forming the largest cycle found.

Returns:
the Iterator.

largestCycleEdges

public java.util.Iterator largestCycleEdges()
Returns an Iterator over the edges forming the largest cycle found.

Returns:
the Iterator.

largestCycleLength

public int largestCycleLength()
Returns the length of the largest cycle found.

Returns:
the number of nodes (edges) of the largest cycle.