nl.uu.cs.treewidth.graph
Class Graph<Data>

java.lang.Object
  extended by nl.uu.cs.treewidth.graph.Graph<Data>
Type Parameters:
Data -

Deprecated.

@Deprecated
public class Graph<Data>
extends java.lang.Object

Deprecated! Use the NGraph instead.

Standard datastructure for representing graphs. Its main use is as a standardized way to communicate graphs throughout the framework. (For example, a GraphInput returns a Graph and an Algorithm gets its input as a Graph.)

TODO More explanation of how the datastructure works.

Example usage: Read a graph from a file in DGF format.

 GraphInput input = new DgfReader( "myGraph.dgf" );
 Graph g = new Graph();
 try {
 
     g = input.get();
     
 } catch (InputException e) { ... }
 

Example usage: Manually create C3

 Graph g = new Graph();
 
 Vertex v1 = new Vertex();
 g.addVertex( v1 );
 
 Vertex v2 = new Vertex();
 g.addVertex( v2 );
 
 Vertex v3 = new Vertex();
 g.addVertex( v3 );
 
 g.addEdge( v1, v2 );
 g.addEdge( v2, v3 );
 g.addEdge( v3, v1 );
 

Author:
tw team

Nested Class Summary
static interface Graph.Convertor<OldData,NewData>
          Deprecated.  
static class Graph.Copier<CopiedData>
          Deprecated. Does NOT make a deep copy of the vertices' data.
 
Field Summary
 java.util.ArrayList<Vertex<Data>> vertices
          Deprecated. List of the vertices of the graph.
 
Constructor Summary
Graph()
          Deprecated. Creates an empty graph with no comments.
Graph(NeighborHashSetGraph<Data> g)
          Deprecated.  
 
Method Summary
 void addComment(java.lang.String c)
          Deprecated. Adds a new line of comments to the graph.
 void addEdge(Vertex<Data> a, Vertex<Data> b)
          Deprecated. Adds an edge between a and b in the graph.
 void addVertex(Vertex<Data> v)
          Deprecated. Adds a vertex to the graph.
 void clearEdgeCache()
          Deprecated. Makes sure the cached edgelist is no longer used.
 void contractEdge(Edge<Data> e)
          Deprecated.  
static
<OldData,NewData>
Graph<NewData>
copy(Graph<? extends OldData> oldG, Graph.Convertor<OldData,NewData> dataConvertor)
          Deprecated.  
 void deEliminateVertex(Vertex<Data> v, java.util.ArrayList<Edge<Data>> addedEdges)
          Deprecated. Function adds a vertex and removes edges; it reverses a vertex elimination
<T> java.util.ArrayList<Edge<T>>
eliminateVertex(Vertex<T> v)
          Deprecated. Eliminates a vertex from the copy of the graph by marrying the neighbors and removing the vertex.
 java.lang.String getComments()
          Deprecated.  
 java.util.ArrayList<Edge<Data>> getEdges()
          Deprecated. Computes the edgelist of the graph.
 void removeEdge(Edge<Data> e)
          Deprecated. Removes an edge from the edgelist of it's two vertices
 void removeVertex(Vertex<Data> v)
          Deprecated.  
static
<CopiedData>
Graph<CopiedData>
shallowCopy(Graph<CopiedData> g)
          Deprecated.  
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertices

public java.util.ArrayList<Vertex<Data>> vertices
Deprecated. 
List of the vertices of the graph.

Constructor Detail

Graph

public Graph()
Deprecated. 
Creates an empty graph with no comments.


Graph

public Graph(NeighborHashSetGraph<Data> g)
Deprecated. 
Method Detail

addVertex

public void addVertex(Vertex<Data> v)
Deprecated. 
Adds a vertex to the graph.

Parameters:
v - The vertex to add.

addEdge

public void addEdge(Vertex<Data> a,
                    Vertex<Data> b)
Deprecated. 
Adds an edge between a and b in the graph.

Parameters:
a -
b -

addComment

public void addComment(java.lang.String c)
Deprecated. 
Adds a new line of comments to the graph. (Note that a newline is automatically prefixed.)

Parameters:
c - The comment line

getComments

public java.lang.String getComments()
Deprecated. 
Returns:
The comments for this graph.

getEdges

public java.util.ArrayList<Edge<Data>> getEdges()
Deprecated. 
Computes the edgelist of the graph.
Caution: This method uses cached data. If you manually change the vertices in the graph, call the function clearEdgeCache() to make sure the cached data is not used.

Returns:
Edgelist of the graph.

shallowCopy

public static <CopiedData> Graph<CopiedData> shallowCopy(Graph<CopiedData> g)
Deprecated. 

copy

public static <OldData,NewData> Graph<NewData> copy(Graph<? extends OldData> oldG,
                                                    Graph.Convertor<OldData,NewData> dataConvertor)
Deprecated. 

contractEdge

public void contractEdge(Edge<Data> e)
Deprecated. 

removeVertex

public void removeVertex(Vertex<Data> v)
Deprecated. 

eliminateVertex

public <T> java.util.ArrayList<Edge<T>> eliminateVertex(Vertex<T> v)
Deprecated. 
Eliminates a vertex from the copy of the graph by marrying the neighbors and removing the vertex.
This method does NOT update the edgelist of the copy of the graph, because it is not used. Returns a list with edges added during the elimination proces

Parameters:
v - The vertex to remove from the copy of the graph.

deEliminateVertex

public void deEliminateVertex(Vertex<Data> v,
                              java.util.ArrayList<Edge<Data>> addedEdges)
Deprecated. 
Function adds a vertex and removes edges; it reverses a vertex elimination


removeEdge

public void removeEdge(Edge<Data> e)
Deprecated. 
Removes an edge from the edgelist of it's two vertices


clearEdgeCache

public void clearEdgeCache()
Deprecated. 
Makes sure the cached edgelist is no longer used. Call this function if you change something in the vertices of the graph without using the methods in Graph.