Class CycleGenerator

java.lang.Object
  |
  +--CycleGenerator
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener

public class CycleGenerator
extends java.lang.Object
implements javax.swing.event.ChangeListener

Class that generates all relevant cycles of length 3 or bigger for a given Graph. A relevant cycle is a cycle that cannot be created as a sum of two other cycles in the cycle vector space. In fact this algorithm constructs all cycles composed of two shortest paths (even cycles) or two shortest paths and an edge, of which the relevant cycles are a subset.

Author:
Dries.VanDyck@rug.ac.be
See Also:
Graph, Cycle, Path, PathGenerator

Constructor Summary
CycleGenerator(Graph g)
          Constructs a new CycleGenerator object for the graph g and registers itself as ChangeListener for g.
 
Method Summary
 java.util.ArrayList[] cycles()
          Returns all cycles as a ArrayList of Cycle's with all cycles of length l at index l-3.
 java.util.ArrayList cycles(int l)
          Returns all cycles of length l as a ArrayList of Cycle's.
 int girth()
          Returns the girth of the Graph.
 java.util.ArrayList girthCycles()
          Returns all girth cycles as a ArrayList of Cycle's.
static void main(java.lang.String[] args)
          Program which prints all relevant cycles to the screen of the YutsisGraph specified by the first argument.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Implementation of the ChangeListener interface.
 java.lang.String toString()
          A String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CycleGenerator

public CycleGenerator(Graph g)
Constructs a new CycleGenerator object for the graph g and registers itself as ChangeListener for g.

Parameters:
g - the graph for which all relevant cycles have to be generated
See Also:
Graph
Method Detail

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Implementation of the ChangeListener interface.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

girth

public int girth()
Returns the girth of the Graph.

Returns:
the girth of the Graph.
See Also:
Graph

girthCycles

public java.util.ArrayList girthCycles()
Returns all girth cycles as a ArrayList of Cycle's. cycles of length l at index l-3.

Returns:
all girth cycles as an array of ArrayLists
See Also:
Cycle

cycles

public java.util.ArrayList[] cycles()
Returns all cycles as a ArrayList of Cycle's with all cycles of length l at index l-3.

Returns:
all relevant cycles as an array of ArrayLists
See Also:
Cycle

cycles

public java.util.ArrayList cycles(int l)
Returns all cycles of length l as a ArrayList of Cycle's.

Parameters:
l - the length of the relevant Cycle's to be returned
Returns:
the relevant Cycle's of the specified length
See Also:
Cycle

toString

public java.lang.String toString()
A String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this CycleGenerator object

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Program which prints all relevant cycles to the screen of the YutsisGraph specified by the first argument. When ran without arguments it prints a "usage" to System.err. However this class can be used with each object implementing the Graph interface, this main function (and thus the program) only works on YutsisGraphs.

java.io.IOException