uk.ac.bbk.dcs.automed.graph
Class DirectedGraph

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.graph.DirectedGraph

public class DirectedGraph
extends java.lang.Object

Class that abstracts a directed unlabelled graph.

Author:
Lucas Zamboulis

Constructor Summary
DirectedGraph()
           
 
Method Summary
 void addGraphNode(DirectedGraphNode n)
          Adds a node in the graph.
protected  void addSubGraph(DirectedGraph graph)
          Adds a subGraph in the set of subGraphs.
 boolean containsGraphNode(DirectedGraphNode n)
           
protected  java.util.LinkedList getGraph()
           
protected  DirectedGraphNode getNode(int i)
           
 DirectedGraphNode getNode(java.lang.String name)
           
protected  java.util.HashSet getSubGraphs()
           
 java.util.HashSet graphToForest(Forest f)
          This method first divides a given graph into subGraphs.
protected  void identifySubGraphs()
          Discovers the subGraphs in the graph
protected  void printGraph(DirectedGraph n)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectedGraph

public DirectedGraph()
Method Detail

addGraphNode

public void addGraphNode(DirectedGraphNode n)
                  throws GraphException
Adds a node in the graph.

Parameters:
n - the node to add
Throws:
GraphException

containsGraphNode

public boolean containsGraphNode(DirectedGraphNode n)
Parameters:
n - a DirectedGraphNode object
Returns:
true if the object given exists in the graph; false otherwise

getGraph

protected java.util.LinkedList getGraph()
Returns:
the nodes consisting the graph

size

public int size()
Returns:
the number of nodes consisting the graph

getNode

protected DirectedGraphNode getNode(int i)

getNode

public DirectedGraphNode getNode(java.lang.String name)
                          throws NotFoundException
Throws:
NotFoundException

graphToForest

public java.util.HashSet graphToForest(Forest f)
                                throws GraphException
This method first divides a given graph into subGraphs. Then it converts each one to a tree, effectively transforming a graph into a forest

Parameters:
graph - the graph
Returns:
the forest
Throws:
GraphException

getSubGraphs

protected java.util.HashSet getSubGraphs()
Returns:
the subGraphs of the graph

addSubGraph

protected void addSubGraph(DirectedGraph graph)
Adds a subGraph in the set of subGraphs.

Parameters:
graph - the subGraph to add

identifySubGraphs

protected void identifySubGraphs()
                          throws GraphException
Discovers the subGraphs in the graph

Throws:
GraphException

printGraph

protected void printGraph(DirectedGraph n)