gr.demokritos.iit.jinsect.structs
Class UniqueVertexGraph

java.lang.Object
  extended by salvo.jesus.graph.GraphImpl
      extended by salvo.jesus.graph.WeightedGraphImpl
          extended by gr.demokritos.iit.jinsect.structs.UniqueVertexGraph
All Implemented Interfaces:
java.io.Serializable, salvo.jesus.graph.Graph, salvo.jesus.graph.WeightedGraph
Direct Known Subclasses:
DistributionGraph, SymbolicGraph

public class UniqueVertexGraph
extends salvo.jesus.graph.WeightedGraphImpl
implements java.io.Serializable

A weighted graph, where the vertices have unique labels.

See Also:
Serialized Form

Field Summary
 java.util.HashMap<java.lang.String,salvo.jesus.graph.Vertex> UniqueVertices
          The map of vertices and labels.
 
Fields inherited from class salvo.jesus.graph.GraphImpl
factory, traversal
 
Constructor Summary
UniqueVertexGraph()
          Initializes the graph.
 
Method Summary
 void add(salvo.jesus.graph.Vertex v)
          Adds a new vertex to the graph, checking for duplicate labels.
 void addEdge(salvo.jesus.graph.Edge edge)
          Adds a new edge to the graph, checking for duplicate labels of its vertices.
 salvo.jesus.graph.Edge addEdge(salvo.jesus.graph.Vertex vHead, salvo.jesus.graph.Vertex vTail)
          Adds a new edge to the graph, checking for duplicate labels of its vertices.
 boolean contains(salvo.jesus.graph.Vertex v)
          Checks whether a given vertex exists in this graph.
 salvo.jesus.graph.Vertex locateVertex(salvo.jesus.graph.Vertex v)
          Looks up a given vertex in this graph.
static void main(java.lang.String[] args)
           
 
Methods inherited from class salvo.jesus.graph.WeightedGraphImpl
addEdge, getClosest, minimumSpanningTree, setMinimumSpanningTreeAlgorithm, setShortestPathAlgorithm, shortestPath
 
Methods inherited from class salvo.jesus.graph.GraphImpl
addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, addListener, cloneVertices, containsEdge, containsVertex, forgetConnectedSets, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getEdgesCount, getEdgeSet, getGraphFactory, getTraversal, getVertexSet, getVertices, getVerticesCount, getVerticesIterator, isConnected, remove, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, removeListener, setGraphFactory, setTraversal, toString, traverse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface salvo.jesus.graph.Graph
addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, addListener, cloneVertices, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getEdgesCount, getEdgeSet, getGraphFactory, getTraversal, getVertexSet, getVertices, getVerticesCount, getVerticesIterator, isConnected, remove, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, removeListener, setGraphFactory, setTraversal, traverse
 

Field Detail

UniqueVertices

public java.util.HashMap<java.lang.String,salvo.jesus.graph.Vertex> UniqueVertices
The map of vertices and labels.

Constructor Detail

UniqueVertexGraph

public UniqueVertexGraph()
Initializes the graph.

Method Detail

contains

public boolean contains(salvo.jesus.graph.Vertex v)
Checks whether a given vertex exists in this graph.

Parameters:
v - The vertex, the label of which will be used for the lookup.
Returns:
True if the vertex is contained in this graph. Otherwise false.

locateVertex

public salvo.jesus.graph.Vertex locateVertex(salvo.jesus.graph.Vertex v)
Looks up a given vertex in this graph.

Parameters:
v - The vertex, the label of which will be used for the lookup.
Returns:
The vertex if it is contained in this graph. Otherwise null.

add

public void add(salvo.jesus.graph.Vertex v)
         throws java.lang.Exception
Adds a new vertex to the graph, checking for duplicate labels.

Specified by:
add in interface salvo.jesus.graph.Graph
Overrides:
add in class salvo.jesus.graph.GraphImpl
Parameters:
v - The vertex to add.
Throws:
java.lang.Exception - If a vertex with the same label already exists.

addEdge

public salvo.jesus.graph.Edge addEdge(salvo.jesus.graph.Vertex vHead,
                                      salvo.jesus.graph.Vertex vTail)
                               throws java.lang.Exception
Adds a new edge to the graph, checking for duplicate labels of its vertices.

Specified by:
addEdge in interface salvo.jesus.graph.Graph
Overrides:
addEdge in class salvo.jesus.graph.GraphImpl
Parameters:
vHead - The edge head to add.
vTail - The edge tail to add.
Returns:
The newly added edge
Throws:
java.lang.Exception - If the edge cannot be added.

addEdge

public void addEdge(salvo.jesus.graph.Edge edge)
             throws java.lang.Exception
Adds a new edge to the graph, checking for duplicate labels of its vertices.

Specified by:
addEdge in interface salvo.jesus.graph.Graph
Overrides:
addEdge in class salvo.jesus.graph.GraphImpl
Parameters:
eEdge - The edge to add.
Throws:
java.lang.Exception - If the edge cannot be added.

main

public static void main(java.lang.String[] args)