Class AbstractYutsis

java.lang.Object
  |
  +--AbstractGraph
        |
        +--AbstractYutsis
All Implemented Interfaces:
java.lang.Cloneable, Graph, Yutsis
Direct Known Subclasses:
YutsisGraph

public abstract class AbstractYutsis
extends AbstractGraph
implements Yutsis

Abstract implementation of a (cubic) graph allowing the graph transformations used to reduce a YutsisGraph by implementing the Graph interface. A ChangeListener can be registered to listen to ChangeEvents fired when the underlying cubic graph is structurally changed, i.e. a change reflected in the Cycle Vector Space spanned by a cycle base of the graph.

Author:
Dries.VanDyck@rug.ac.be
See Also:
Graph

Field Summary
static int BRAKET
          Int representing the BRAKET format in which the graphs are stored in a file: this represents the well known braket notation e.g.
static int EDGELIST
          Int representing the EDGELIST format in which the graphs are stored in a file:
static int YTS
          Int representing the YTS format in which the graphs are stored in a file: the first line contains the (cubic) order (n) of the graph, followed by 2n lines with three labels representing the couplings in the nodes.
 
Constructor Summary
AbstractYutsis()
           
 
Method Summary
 java.lang.String addIntermediateLabels(java.lang.String braket)
          Adds intermediate labels to a BRAKET representation.
static int guessFileFormat(java.lang.String filename)
          Guesses the format of the file by looking at the first two lines.
 void interchange(int node1, int node2, int icnode1, int icnode2)
          Interchange on the edge (node1, node2) interchanging the edges (node1, icnode1) and (node2, icnode2).
 boolean intermediateLabelsPresent(java.lang.String braket)
          Returns true if the intermediate labels APPEAR to be present, false otherwise.
 int nrOfEdges()
          Implementation of the method Graph.nrOfEdges() as specified by the Graph interface.
 void removeTriangle(int node1, int node2, int node3)
          Removes the triangle node1, node2, node3.
 boolean triangularDelta()
          True if the graph represents a triangular delta, false otherwise.
 boolean triangularDelta(int[] td)
          True if the graph represents a triangular delta between node td[0] and td[1], false otherwise.
 boolean triangularDelta(int node1, int node2)
          True if the graph represents a triangular delta between node node1 and node2, false otherwise.
 
Methods inherited from class AbstractGraph
addChangeListener, clone, connected, fireStateChanged, gmlEdgeLabels, isTree, removeChangeListener, toGml, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Yutsis
bubble, clone, interchange, removeBubble, removeTriangle, triangle, triangles
 
Methods inherited from interface Graph
addChangeListener, connected, first, isRemoved, isTree, last, neighbors, nodeIterator, nrOfNodes, order, removeChangeListener, toGml
 

Field Detail

YTS

public static final int YTS
Int representing the YTS format in which the graphs are stored in a file: the first line contains the (cubic) order (n) of the graph, followed by 2n lines with three labels representing the couplings in the nodes. The first n lines, of those 2n lines correspond to the left tree in the braket, the next n lines those of the right tree in the braket.

See Also:
Constant Field Values

BRAKET

public static final int BRAKET
Int representing the BRAKET format in which the graphs are stored in a file: this represents the well known braket notation e.g.
<(j1,j2)j12|(j2,j1)j12>
.

See Also:
Constant Field Values

EDGELIST

public static final int EDGELIST
Int representing the EDGELIST format in which the graphs are stored in a file:
 <nrOfnodes> <nrOfEdges>
 <edge> <edge> ... <edge> 
With <edge> = node1 node2, the edges may be distributed over several lines, but linebreaks are not allowed between two nodes of the same edge. No syntax checks are performed.

See Also:
Constant Field Values
Constructor Detail

AbstractYutsis

public AbstractYutsis()
Method Detail

guessFileFormat

public static int guessFileFormat(java.lang.String filename)
                           throws java.io.IOException
Guesses the format of the file by looking at the first two lines. The aim is to distinguinsh the different file formats by simple differences like the number of tokens on a line, NOT to check for correct syntax!

Parameters:
filename - the filename of the file
Returns:
the guessed format as an int (BRAKET, YTS or EDGELIST) or -1 if unsupported (i.e. not recognized)
java.io.IOException

intermediateLabelsPresent

public boolean intermediateLabelsPresent(java.lang.String braket)
Returns true if the intermediate labels APPEAR to be present, false otherwise. Only the first intermediate label is checked.

Parameters:
braket - the String to be checked if intermediate labels are present
Returns:
true if the intermediate labels APPEAR to be present, otherwise false.

addIntermediateLabels

public java.lang.String addIntermediateLabels(java.lang.String braket)
Adds intermediate labels to a BRAKET representation.

Parameters:
braket - the BRAKET representation
Returns:
a new BRAKET representation with intermediate labels

nrOfEdges

public int nrOfEdges()
Implementation of the method Graph.nrOfEdges() as specified by the Graph interface.

Specified by:
nrOfEdges in interface Graph
Returns:
the number of edges
See Also:
AbstractGraph, Graph

interchange

public void interchange(int node1,
                        int node2,
                        int icnode1,
                        int icnode2)
Interchange on the edge (node1, node2) interchanging the edges (node1, icnode1) and (node2, icnode2).

Specified by:
interchange in interface Yutsis
Parameters:
node1 - first node of the edge on which the interchange is performed
node2 - second node of the edge on which the interchange is performed
icnode1 - neighbor of node1 to be interchanged with icnode2
icnode2 - neighbor of node2 to be interchanged with icnode1

removeTriangle

public void removeTriangle(int node1,
                           int node2,
                           int node3)
Removes the triangle node1, node2, node3.

Specified by:
removeTriangle in interface Yutsis
Parameters:
node1 - first node of the triangle to be removed
node2 - second node of the triangle to be removed
node3 - third node of the triangle to be removed

triangularDelta

public boolean triangularDelta()
True if the graph represents a triangular delta, false otherwise.

Specified by:
triangularDelta in interface Yutsis
Returns:
true if this graph represents a triangular delta

triangularDelta

public boolean triangularDelta(int[] td)
True if the graph represents a triangular delta between node td[0] and td[1], false otherwise.

Specified by:
triangularDelta in interface Yutsis
Parameters:
td - the nodes of the triangular delta as an array
Returns:
true if this Graph is a triangular delta between the specified nodes

triangularDelta

public boolean triangularDelta(int node1,
                               int node2)
True if the graph represents a triangular delta between node node1 and node2, false otherwise.

Specified by:
triangularDelta in interface Yutsis
Parameters:
node1 - first node of the triangular delta to be formatted
node2 - second node of the triangular delta to be formatted
Returns:
true if this Graph is a triangular delta between the specified nodes