de.aitools.iv.graphdrawing.datastructures.graph
Class DirectedGraph

java.lang.Object
  extended by de.aitools.iv.graphdrawing.datastructures.graph.DirectedGraph
All Implemented Interfaces:
Graph

public class DirectedGraph
extends java.lang.Object
implements Graph

Author:
smze@upb.de

Constructor Summary
DirectedGraph()
          Constructor
DirectedGraph(int size)
          Constructor
 
Method Summary
 void addEdge(Edge e)
          adds an edge to the graph.
 void addVertex(Vertex v)
          adds a Vertex to the graph.
 java.util.Iterator edgeIterator()
          returns all edges that point from a vertex to an other vertex
 int getEdgeCount()
           
 double getSumOfEdgeWeights(double threshold)
           
 double getSumOfEdgeWeights(int[] vertices, double threshold)
           
 Vertex getVertex(int id)
          Returns the vertex with this id
 int getVertexCount()
           
 java.util.Iterator incomingEdgeIterator(Vertex v)
           
static void main(java.lang.String[] args)
          main-function for debug
 java.util.Iterator outgoingEdgeIterator(Vertex v)
          returns all incident edges from the given vertex
 void removeEdge(Edge e)
          remove an edge from the graph (and from both adjacent Vertices) //O(1)
 void removeVertex(Vertex v)
          remove the Vertex and all incident edges from the graph.
 java.lang.String toString()
          toString-method only for debugging
 java.util.Iterator vertexIterator()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectedGraph

public DirectedGraph()
Constructor


DirectedGraph

public DirectedGraph(int size)
Constructor

Parameters:
size - the initial capacity of the vector
Method Detail

addVertex

public void addVertex(Vertex v)
adds a Vertex to the graph.

Parameters:
v - the Vertex to be added

vertexIterator

public java.util.Iterator vertexIterator()
Specified by:
vertexIterator in interface Graph
Returns:
an iterator for the vertices that belongs to this graph

getVertexCount

public int getVertexCount()
Specified by:
getVertexCount in interface Graph
Returns:
the number of vertices that belong to this graph

getEdgeCount

public int getEdgeCount()
Specified by:
getEdgeCount in interface Graph

removeVertex

public void removeVertex(Vertex v)
remove the Vertex and all incident edges from the graph. //O(|connected edges|)

Parameters:
v - the Vertex to be removed

getVertex

public Vertex getVertex(int id)
Returns the vertex with this id

Parameters:
id - of the Vertex
Returns:
the Vertex or NULL

addEdge

public void addEdge(Edge e)
adds an edge to the graph. //O(1)

Parameters:
e - the Edge to be added.

removeEdge

public void removeEdge(Edge e)
remove an edge from the graph (and from both adjacent Vertices) //O(1)

Parameters:
e - the Edge to be removed

outgoingEdgeIterator

public java.util.Iterator outgoingEdgeIterator(Vertex v)
returns all incident edges from the given vertex

Parameters:
v - the connected Vertex

incomingEdgeIterator

public java.util.Iterator incomingEdgeIterator(Vertex v)

edgeIterator

public java.util.Iterator edgeIterator()
returns all edges that point from a vertex to an other vertex

Specified by:
edgeIterator in interface Graph
Returns:
all edges that point from a vertex to an other vertex

toString

public java.lang.String toString()
toString-method only for debugging

Overrides:
toString in class java.lang.Object
Returns:
a String that represents this UndirectedGraph

main

public static void main(java.lang.String[] args)
main-function for debug


getSumOfEdgeWeights

public double getSumOfEdgeWeights(int[] vertices,
                                  double threshold)
Specified by:
getSumOfEdgeWeights in interface Graph

getSumOfEdgeWeights

public double getSumOfEdgeWeights(double threshold)
Specified by:
getSumOfEdgeWeights in interface Graph