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

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

@ALDMetaInfo(export=ALLOWED)
public class MTBGraph
extends 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  Vector<MTBGraphEdge> edges
          Vector of included graph edges.
protected  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(Vector<MTBGraphNode<?>> nodes, 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.
 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.
 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

nodes

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


edges

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


directed

protected boolean directed
True if MTBGraph is directed.


numberOfNodes

protected int numberOfNodes
Number of nodes in the MTBGraph.


numberOfEdges

protected int numberOfEdges
Number of edges 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(Vector<MTBGraphNode<?>> nodes,
                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

isDirected

public boolean isDirected()
Directed or undirected graph?

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

getNodes

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

Returns:
Vector of MTBGraphNodes.

getEdges

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

Returns:
Vector of MTBGraphEdges.

getNodeNum

public int getNodeNum()
Get number of included MTBGraphNodes.

Returns:
Number of nodes.

getEdgeNum

public int getEdgeNum()
Get number of included MTBGraphEdges.

Returns:
Number of edges.

addNode

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

Parameters:
node - MTBGraphNode to add

addEdge

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

Parameters:
edge - MTBGraphEdge to add

getGraphCost

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


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.


print

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



Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.