gr.demokritos.iit.jinsect.structs
Class Graph

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

public class Graph
extends salvo.jesus.graph.WeightedGraphImpl

A weighted graph, where the vertices have unique labels.

See Also:
Serialized Form

Field Summary
protected  EdgeCachedLocator eclLocator
          Optimized edge locator.
 java.util.HashMap UniqueVertices
          The map of vertices and labels.
 
Fields inherited from class salvo.jesus.graph.GraphImpl
factory, traversal
 
Constructor Summary
Graph()
          Initializes the graph.
 
Method Summary
 void add(salvo.jesus.graph.Vertex v)
          Adds a new vertex to the graph, checking for duplicate labels.
 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.
 void remove(salvo.jesus.graph.Vertex v)
          Removes a given vertex from this graph.
 
Methods inherited from class salvo.jesus.graph.WeightedGraphImpl
addEdge, getClosest, minimumSpanningTree, setMinimumSpanningTreeAlgorithm, setShortestPathAlgorithm, shortestPath
 
Methods inherited from class salvo.jesus.graph.GraphImpl
addEdge, 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, 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
addEdge, addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, addListener, cloneVertices, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getEdgesCount, getEdgeSet, getGraphFactory, getTraversal, getVertexSet, getVertices, getVerticesCount, getVerticesIterator, isConnected, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, removeListener, setGraphFactory, setTraversal, traverse
 

Field Detail

UniqueVertices

public java.util.HashMap UniqueVertices
The map of vertices and labels.


eclLocator

protected EdgeCachedLocator eclLocator
Optimized edge locator.

Constructor Detail

Graph

public Graph()
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.
Throws:
java.lang.Exception - If the edge cannot be added.

remove

public void remove(salvo.jesus.graph.Vertex v)
            throws java.lang.Exception
Removes a given vertex from this graph.

Specified by:
remove in interface salvo.jesus.graph.Graph
Overrides:
remove in class salvo.jesus.graph.GraphImpl
Parameters:
v - The vertex to remove.
Throws:
java.lang.Exception - If the vertex cannot be removed.