org.metasyntactic.math
Class AbstractGraph

java.lang.Object
  |
  +--org.metasyntactic.math.AbstractGraph
All Implemented Interfaces:
Graph

public abstract class AbstractGraph
extends java.lang.Object
implements Graph


Nested Class Summary
 
Nested classes inherited from class org.metasyntactic.math.Graph
Graph.Edge, Graph.Path
 
Field Summary
protected  java.util.Set edges
           
protected  boolean modified
           
protected  java.util.Set vertices
           
 
Constructor Summary
AbstractGraph()
           
 
Method Summary
 boolean containsEdge(java.util.List edge)
           
 boolean containsVertex(java.lang.Object vertex)
           
protected abstract  java.util.Set directlyConnected(java.lang.Object start)
          The set of states directly connected by one edge to this node
 boolean equals(java.lang.Object o)
           
 java.util.Set getEdges()
          For a graph G = (V, E), this return E
 java.util.Set getVertices()
          For a graph G = (V, E), this returns V
 int hashCode()
           
 boolean isReachable(java.lang.Object start, java.lang.Object end)
          If there is a path p from u to u' we say that u' is reachable from u via p.
 boolean isSubgraph(Graph g_prime)
          We say that a graph G' = (V', E') is a subgraph of G = (V, E) if V' ⊆ V and E' ⊆ E.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 java.lang.Object[][] toTable()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.metasyntactic.math.Graph
addEdge, addVertex, areAdjacent, degree, induce
 

Field Detail

vertices

protected java.util.Set vertices

edges

protected java.util.Set edges

modified

protected boolean modified
Constructor Detail

AbstractGraph

public AbstractGraph()
Method Detail

isSubgraph

public boolean isSubgraph(Graph g_prime)
Description copied from interface: Graph
We say that a graph G' = (V', E') is a subgraph of G = (V, E) if V' ⊆ V and E' ⊆ E.

Specified by:
isSubgraph in interface Graph
Parameters:
g_prime - The graph you are checking whether or not it is a subgraph of this graph
Returns:
true if g_prime is a subgraph of this graph

isReachable

public boolean isReachable(java.lang.Object start,
                           java.lang.Object end)
Description copied from interface: Graph
If there is a path p from u to u' we say that u' is reachable from u via p.

Specified by:
isReachable in interface Graph

directlyConnected

protected abstract java.util.Set directlyConnected(java.lang.Object start)
The set of states directly connected by one edge to this node


equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getVertices

public java.util.Set getVertices()
Description copied from interface: Graph
For a graph G = (V, E), this returns V

Specified by:
getVertices in interface Graph
Returns:
the vertices of this graph

getEdges

public java.util.Set getEdges()
Description copied from interface: Graph
For a graph G = (V, E), this return E

Specified by:
getEdges in interface Graph
Returns:
the edges of this graph

toString

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

toTable

public java.lang.Object[][] toTable()

main

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

containsVertex

public boolean containsVertex(java.lang.Object vertex)
Specified by:
containsVertex in interface Graph

containsEdge

public boolean containsEdge(java.util.List edge)
Specified by:
containsEdge in interface Graph