edu.mit.csail.sdg.alloy4
Class DirectedGraph<N>

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4.DirectedGraph<N>
Type Parameters:
N - - the type of node

public final class DirectedGraph<N>
extends java.lang.Object

Mutable; implements a directed graph; null node is allowed.

Note: it uses n1==n2 for comparing nodes rather than using n1.equals(n2)


Constructor Summary
DirectedGraph()
          Constructs an empty graph.
 
Method Summary
 void addEdge(N start, N end)
          Add a directed edge from start node to end node (if there wasn't such an edge already).
 boolean hasPath(N start, N end)
          Returns whether there is a directed path from start node to end node by following directed edges 0 or more times (breath-first).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectedGraph

public DirectedGraph()
Constructs an empty graph.

Method Detail

addEdge

public void addEdge(N start,
                    N end)
Add a directed edge from start node to end node (if there wasn't such an edge already).


hasPath

public boolean hasPath(N start,
                       N end)
Returns whether there is a directed path from start node to end node by following directed edges 0 or more times (breath-first).