Class Cycle

java.lang.Object
  |
  +--Cycle

public class Cycle
extends java.lang.Object

Class representing relevant cycles, which are by definition composed of two cyclic canonical shortest Paths (for even cycles) or two cyclic canonical shortest Paths and an edge (for odd cycles). We call a path cyclic canonical if it starts with the node with lowest label.

Author:
Dries.VanDyck@rug.ac.be
See Also:
NodeIterator, Path

Constructor Summary
Cycle(Path ry, Path rz)
          Constructs an odd relevant cycle made of a shortest path from r->y (ry), a shortest path from r->z (rz) and the edge (y,z).
Cycle(Path rp, Path rq, int y)
          Constructs an even cycle made of a shortest path from r->p (rp), a shortest path from r->q (rq) and the edges (p,y) and (q,y).
 
Method Summary
 NodeIterator first()
          Returns an NodeIterator over the nodes of this path following the edges of this path starting at the first node (by a call to the next() method).
 NodeIterator last()
          Returns an NodeIterator over the nodes of this cycle following the edges of this path ending at the node with lowest label (by a call to the previous() method).
 int length()
          Returns the length of this cycle (nr of edges).
 int nodeAt(int index)
          Returns the node with index index if the cycle was iterated by a NodeIterator.
 NodeIterator nodeIterator(int node)
          Returns an NodeIterator over the nodes of this cycle following the edges of this cycle starting at the specified node (by a call to the next() method).
 java.lang.String toString()
          A String representation of this cycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cycle

public Cycle(Path ry,
             Path rz)
Constructs an odd relevant cycle made of a shortest path from r->y (ry), a shortest path from r->z (rz) and the edge (y,z).

Parameters:
ry - a cyclic canonical shortest path from r to y
rz - a cyclic canonical shortest path from r to z
See Also:
Path

Cycle

public Cycle(Path rp,
             Path rq,
             int y)
Constructs an even cycle made of a shortest path from r->p (rp), a shortest path from r->q (rq) and the edges (p,y) and (q,y).

Parameters:
rp - a cyclic canonical shortest path from r to p
rq - a cyclic canonical shortest path from r to q
y - a node connected with p and q
See Also:
Path
Method Detail

length

public int length()
Returns the length of this cycle (nr of edges).

Returns:
the length of this cycle

nodeAt

public int nodeAt(int index)
Returns the node with index index if the cycle was iterated by a NodeIterator.

Parameters:
index - the index of the node to be returned
Returns:
the node at the specified index

first

public NodeIterator first()
Returns an NodeIterator over the nodes of this path following the edges of this path starting at the first node (by a call to the next() method).

Returns:
a NodeIterator pointing to the first node
See Also:
NodeIterator

last

public NodeIterator last()
Returns an NodeIterator over the nodes of this cycle following the edges of this path ending at the node with lowest label (by a call to the previous() method).

Returns:
a NodeIterator pointing to the last node
See Also:
NodeIterator

nodeIterator

public NodeIterator nodeIterator(int node)
Returns an NodeIterator over the nodes of this cycle following the edges of this cycle starting at the specified node (by a call to the next() method).

Returns:
a NodeIterator pointing to the last node
See Also:
NodeIterator

toString

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

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