Interface Graph

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
Yutsis
All Known Implementing Classes:
AbstractGraph, AbstractYutsis

public interface Graph
extends java.lang.Cloneable

Interface of a general graph of which the nodes are labeled with positive integers in an arbitrary way.

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

Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to the YutsisGraph.
 boolean connected(int i, int j)
          True if nodes i and j are connected, false otherwise.
 NodeIterator first()
          Returns an iterator over the nodeset starting at the node (by calling the next() method) with lowest label in some ordening.
 boolean isRemoved(int node)
          Returns true if the specified node is removed or not apparent in the graph, false otherwise.
 boolean isTree(int[] nodeset)
          Checks of the nodes in the nodeset form a vertex induced tree.
 NodeIterator last()
          Returns an iterator over the nodeset starting at the node with highest label (by calling the previous() method) in some ordening.
 int[] neighbors(int node)
          Returns the neighbors of the node with label node.
 NodeIterator nodeIterator(int node)
          Returns an iterator which will return node by a NodeIterator#next() call.
 int nrOfEdges()
          Returns the number of edges of the underlying graph.
 int nrOfNodes()
          Returns the number of nodes of the underlying graph.
 int order()
          Returns the original order of this graph; there will be nrOfNodes() nodes with labels between 0 and Order(), the latter not included.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes the ChangeListener l from the YutsisGraph.
 void toGml(java.io.PrintStream out)
          Prints the graph in its current state to the PrintStream in gml-format (graphlet).
 

Method Detail

nrOfNodes

public int nrOfNodes()
Returns the number of nodes of the underlying graph.

Returns:
the number of nodes

nrOfEdges

public int nrOfEdges()
Returns the number of edges of the underlying graph.

Returns:
the number of edges

order

public int order()
Returns the original order of this graph; there will be nrOfNodes() nodes with labels between 0 and Order(), the latter not included.

Returns:
the original order of the graph
See Also:
nrOfNodes()

neighbors

public int[] neighbors(int node)
Returns the neighbors of the node with label node.

Parameters:
node - the node of which the neighbors have to be returned
Returns:
the neihbors of the specified node as an array

connected

public boolean connected(int i,
                         int j)
True if nodes i and j are connected, false otherwise.

Parameters:
i - a node of the Graph
j - a node of the Graph
Returns:
true if i and j are connected, false otherwise

isRemoved

public boolean isRemoved(int node)
Returns true if the specified node is removed or not apparent in the graph, false otherwise.

Parameters:
node - the node to be checked
Returns:
true if the node is removed, false otherwise
See Also:
Yutsis

isTree

public boolean isTree(int[] nodeset)
Checks of the nodes in the nodeset form a vertex induced tree. Returns also false when the nodeset is not connected or one of the specified nodes is removed.

Parameters:
nodeset - the nodes to be checked if they induce a tree
Returns:
true, if the specified nodeset induces a tree, false otherwise

first

public NodeIterator first()
Returns an iterator over the nodeset starting at the node (by calling the next() method) with lowest label in some ordening.

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

last

public NodeIterator last()
Returns an iterator over the nodeset starting at the node with highest label (by calling the previous() method) in some ordening.

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

nodeIterator

public NodeIterator nodeIterator(int node)
Returns an iterator which will return node by a NodeIterator#next() call.

Parameters:
node - the node to be returned by the first NodeIterator#next() of the returned NodeIterator
Returns:
a NodeIterator returning node by the first NodeIterator#next() call.
See Also:
NodeIterator, NodeIterator.next()

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the YutsisGraph. Only structural changes are notified, when a node or edge is inverted no listeners are notified.

Parameters:
l - the ChangeListener to be added

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes the ChangeListener l from the YutsisGraph.

Parameters:
l - the ChangeListener to be removed

toGml

public void toGml(java.io.PrintStream out)
Prints the graph in its current state to the PrintStream in gml-format (graphlet).

Parameters:
out - the PrintStream to which output will be written.