ca.ualberta.cs.poker.free.server
Class UndirectedGraph

java.lang.Object
  extended by ca.ualberta.cs.poker.free.server.DirectedGraph
      extended by ca.ualberta.cs.poker.free.server.UndirectedGraph
All Implemented Interfaces:
java.lang.Cloneable

public class UndirectedGraph
extends DirectedGraph
implements java.lang.Cloneable


Field Summary
 
Fields inherited from class ca.ualberta.cs.poker.free.server.DirectedGraph
name, nodes
 
Constructor Summary
UndirectedGraph()
           
 
Method Summary
 void addEdge(Node n1, Node n2)
          Adds a directed edge from the source Node to the dest Directed Node
 void addEdge(Node n1, Node n2, java.lang.Double weight)
           
 java.lang.Object clone()
           
 boolean existsEdge(int source_id, int dest_id)
          Determines if a directed edge exists from the source Node to this destination Node
 boolean existsEdge(Node n1, Node n2)
          Determines if a directed edge exists from the source Node to this destination Node
 java.util.List getRootNodes()
          Returns a List containing all the root nodes (i.e.
 void removeEdge(Node n1, Node n2)
          Removes the directed edge between the source Node and the destination Node
 void removeNode(Node n)
          Removes the specified Node and it's associated edges from this DirectedGraph.
 void setWeight(Node n1, Node n2, java.lang.Double weight)
           
 java.lang.String toString()
           
 
Methods inherited from class ca.ualberta.cs.poker.free.server.DirectedGraph
addNode, dfsVisit, getName, getNode, getRootNode, keyIterator, nodeIterator, setName, size, topologicalSort
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndirectedGraph

public UndirectedGraph()
Method Detail

addEdge

public void addEdge(Node n1,
                    Node n2)
Description copied from class: DirectedGraph
Adds a directed edge from the source Node to the dest Directed Node

Overrides:
addEdge in class DirectedGraph

addEdge

public void addEdge(Node n1,
                    Node n2,
                    java.lang.Double weight)
Overrides:
addEdge in class DirectedGraph

setWeight

public void setWeight(Node n1,
                      Node n2,
                      java.lang.Double weight)

removeNode

public void removeNode(Node n)
Removes the specified Node and it's associated edges from this DirectedGraph.

Overrides:
removeNode in class DirectedGraph
Parameters:
n - the Node to be removed.

removeEdge

public void removeEdge(Node n1,
                       Node n2)
Removes the directed edge between the source Node and the destination Node

Overrides:
removeEdge in class DirectedGraph
Parameters:
source -
dest -

existsEdge

public boolean existsEdge(Node n1,
                          Node n2)
Determines if a directed edge exists from the source Node to this destination Node

Overrides:
existsEdge in class DirectedGraph
Parameters:
source -
dest -
Returns:
true if a directed edge exists between the source Node and the dest Node, returns false otherwise

existsEdge

public boolean existsEdge(int source_id,
                          int dest_id)
Determines if a directed edge exists from the source Node to this destination Node

Overrides:
existsEdge in class DirectedGraph
Parameters:
source_id - the id of the source Node
dest_id - the id of the destination Node
Returns:
true if a directed edge exists between the source Node and the dest Node, returns false otherwise

getRootNodes

public java.util.List getRootNodes()
Description copied from class: DirectedGraph
Returns a List containing all the root nodes (i.e. DirectedNodes with out parents) from this DirectedGraph.

Overrides:
getRootNodes in class DirectedGraph
Returns:
aList of the DirectedNodes from this DirectedGraph which are root nodes

clone

public java.lang.Object clone()
Overrides:
clone in class DirectedGraph

toString

public java.lang.String toString()
Overrides:
toString in class DirectedGraph