de.unihalle.informatik.MiToBo.core.datatypes
Class MTBGraph

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBGraph
Direct Known Subclasses:
MTBNeuriteSkelGraph

public class MTBGraph
extends java.lang.Object

Class implements an (un-) directed MTBGraph. With each MTBGraphNode or MTBGraphEdge specific data can be associated.

Author:
Danny Misiak
See Also:
MTBGraphNode, MTBGraphEdge

Field Summary
protected  boolean directed
          True if MTBGraph is directed.
protected  java.util.Vector<MTBGraphEdge> edges
          Vector of included graph edges.
protected  java.util.Vector<MTBGraphNode<?>> nodes
          Vector of included graph nodes.
protected  int numberOfEdges
          Number of edges in the MTBGraph.
protected  int numberOfNodes
          Number of nodes in the MTBGraph.
 
Constructor Summary
MTBGraph()
          Standard constructor.
MTBGraph(boolean directed)
          Constructor to create an empty undirected or directed MTBGraph.
MTBGraph(java.util.Vector<MTBGraphNode<?>> nodes, java.util.Vector<MTBGraphEdge> edges, boolean directed)
          Constructor to create an undirected or directed MTBGraph with the given nodes and edges.
 
Method Summary
 void addEdge(MTBGraphEdge edge)
          Add a edge to MTBGraph.
 void addNode(MTBGraphNode<?> node)
          Add a node to MTBGraph.
 int getEdgeNum()
          Get number of included MTBGraphEdges.
 java.util.Vector<MTBGraphEdge> getEdges()
          Get all edges of the MTBGraph.
 double getGraphCost()
          Get total amount of the graph costs.
 int getNodeNum()
          Get number of included MTBGraphNodes.
 java.util.Vector<MTBGraphNode<?>> getNodes()
          Get all nodes of the MTBGraph.
 boolean isDirected()
          Directed or undirected graph?
 void print()
          Print the whole MTBGraph with all its nodes and edges.
 void removeEdge(MTBGraphEdge edge)
          Remove the specified edge from the graph
 void removeNode(MTBGraphNode<?> node)
          Remove the specified node from the graph as well as the edges connected to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directed

protected boolean directed
True if MTBGraph is directed.


edges

protected java.util.Vector<MTBGraphEdge> edges
Vector of included graph edges.


nodes

protected java.util.Vector<MTBGraphNode<?>> nodes
Vector of included graph nodes.


numberOfEdges

protected int numberOfEdges
Number of edges in the MTBGraph.


numberOfNodes

protected int numberOfNodes
Number of nodes in the MTBGraph.

Constructor Detail

MTBGraph

public MTBGraph()
Standard constructor. Creates an empty undirected MTBGraph.


MTBGraph

public MTBGraph(boolean directed)
Constructor to create an empty undirected or directed MTBGraph.


MTBGraph

public MTBGraph(java.util.Vector<MTBGraphNode<?>> nodes,
                java.util.Vector<MTBGraphEdge> edges,
                boolean directed)
Constructor to create an undirected or directed MTBGraph with the given nodes and edges.

Parameters:
nodes - vector of MTBGraphNodes
edges - vector of MTBGraphEdges
directed - true if MTBGraph is directed
Method Detail

addEdge

public void addEdge(MTBGraphEdge edge)
Add a edge to MTBGraph.

Parameters:
edge - MTBGraphEdge to add

addNode

public void addNode(MTBGraphNode<?> node)
Add a node to MTBGraph.

Parameters:
node - MTBGraphNode to add

getEdgeNum

public int getEdgeNum()
Get number of included MTBGraphEdges.

Returns:
Number of edges.

getEdges

public java.util.Vector<MTBGraphEdge> getEdges()
Get all edges of the MTBGraph.

Returns:
Vector of MTBGraphEdges.

getGraphCost

public double getGraphCost()
Get total amount of the graph costs. (Sum of all edge costs).


getNodeNum

public int getNodeNum()
Get number of included MTBGraphNodes.

Returns:
Number of nodes.

getNodes

public java.util.Vector<MTBGraphNode<?>> getNodes()
Get all nodes of the MTBGraph.

Returns:
Vector of MTBGraphNodes.

isDirected

public boolean isDirected()
Directed or undirected graph?

Returns:
true if the graph is directed, false if undirected

print

public void print()
Print the whole MTBGraph with all its nodes and edges.


removeEdge

public void removeEdge(MTBGraphEdge edge)
Remove the specified edge from the graph


removeNode

public void removeNode(MTBGraphNode<?> node)
Remove the specified node from the graph as well as the edges connected to it.