public class MTBGraph extends Object
MTBGraphNode
,
MTBGraphEdge
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected Vector<MTBGraphNode<?>> nodes
protected Vector<MTBGraphEdge> edges
protected boolean directed
protected int numberOfNodes
protected int numberOfEdges
public MTBGraph()
public MTBGraph(boolean directed)
public MTBGraph(Vector<MTBGraphNode<?>> nodes, Vector<MTBGraphEdge> edges, boolean directed)
nodes
- vector of MTBGraphNodesedges
- vector of MTBGraphEdgesdirected
- true if MTBGraph is directedpublic boolean isDirected()
public Vector<MTBGraphNode<?>> getNodes()
public Vector<MTBGraphEdge> getEdges()
public int getNodeNum()
public int getEdgeNum()
public void addNode(MTBGraphNode<?> node)
node
- MTBGraphNode to addpublic void addEdge(MTBGraphEdge edge)
edge
- MTBGraphEdge to addpublic double getGraphCost()
public void removeEdge(MTBGraphEdge edge)
public void removeNode(MTBGraphNode<?> node)
public void print()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.