|
jBNC Toolbox | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjbnc.graphs.Graph
Description of the Class
Field Summary | |
protected java.util.HashMap |
vertices
|
Constructor Summary | |
Graph()
|
Method Summary | |
void |
addEdge(Edge e)
|
void |
addEdge(Vertex x,
Vertex y)
|
void |
addVertex(Vertex x)
|
void |
clear()
Remove all vertices and edges. |
boolean |
contains(Vertex x)
Returns true if vertex x is present in the graph. |
void |
dump()
Description of the Method |
int[] |
getChildrenOf(int parentIndex)
Return all children nodes of the parent node with given index. |
Vertex[] |
getChildrenOf(Vertex parent)
Return all children nodes of the given parent node. |
Edge[] |
getEdges()
|
int |
getNumberOfVertices()
Returns number of vertices in the graph. |
Vertex |
getVertex(int index)
Return vertex with given index. |
Vertex[] |
getVertices()
Return vertices as an array. |
static void |
main(java.lang.String[] arg)
Test class Graph. |
Edge |
removeEdge(Vertex in,
Vertex out)
Remove directed edge from the graph. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.HashMap vertices
Constructor Detail |
public Graph()
Method Detail |
public static void main(java.lang.String[] arg)
arg
- The command line argumentspublic Edge[] getEdges()
public int getNumberOfVertices()
public Vertex getVertex(int index)
index
- Description of Parameter
public Vertex[] getVertices()
public Vertex[] getChildrenOf(Vertex parent)
parent
- Parent.
public int[] getChildrenOf(int parentIndex)
parentIndex
- Description of Parameter
public void clear()
public void addVertex(Vertex x) throws java.lang.Exception
x
- The feature to be added to the Vertex attribute
java.lang.Exception
- Vertex is null.public void addEdge(Vertex x, Vertex y) throws java.lang.Exception
x
- The feature to be added to the Edge attributey
- The feature to be added to the Edge attribute
java.lang.Exception
- Description of Exceptionpublic void addEdge(Edge e) throws java.lang.Exception
e
- The feature to be added to the Edge attribute
java.lang.Exception
- Description of Exceptionpublic boolean contains(Vertex x)
x
- Description of Parameter
public Edge removeEdge(Vertex in, Vertex out)
in
- First vertex.out
- Secon vertex.
public void dump()
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |