com.google.javascript.jscomp.graph
Class DiGraph<N,E>

java.lang.Object
  extended by com.google.javascript.jscomp.graph.Graph<N,E>
      extended by com.google.javascript.jscomp.graph.DiGraph<N,E>
Type Parameters:
N - Value type that the graph node stores.
E - Value type that the graph edge stores.
All Implemented Interfaces:
AdjacencyGraph<N,E>
Direct Known Subclasses:
LinkedDirectedGraph

public abstract class DiGraph<N,E>
extends Graph<N,E>

A generic directed graph.


Nested Class Summary
static interface DiGraph.DiGraphEdge<N,E>
          A generic directed graph edge.
static interface DiGraph.DiGraphNode<N,E>
          A generic directed graph node.
 
Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.Graph
Graph.GraphEdge<N,E>
 
Constructor Summary
DiGraph()
           
 
Method Summary
abstract  DiGraph.DiGraphNode<N,E> createDirectedGraphNode(N nodeValue)
           
abstract  void disconnectInDirection(N n1, N n2)
          Disconnects all edges from n1 to n2.
abstract  List<DiGraph.DiGraphEdge<N,E>> getDirectedGraphEdges(N n1, N n2)
           
abstract  DiGraph.DiGraphNode<N,E> getDirectedGraphNode(N nodeValue)
           
abstract  Iterable<DiGraph.DiGraphNode<N,E>> getDirectedGraphNodes()
          Gets an immutable iterable over all the nodes in the graph.
abstract  List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(DiGraph.DiGraphNode<N,E> n)
           
abstract  List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(N nodeValue)
           
abstract  List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> n)
           
abstract  List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(N nodeValue)
           
abstract  List<DiGraph.DiGraphEdge<N,E>> getInEdges(N nodeValue)
          Gets an immutable list of in edges of the given node.
abstract  List<DiGraph.DiGraphEdge<N,E>> getOutEdges(N nodeValue)
          Gets an immutable list of out edges of the given node.
 boolean isConnected(N n1, E e, N n2)
          Checks whether two nodes in the graph are connected by the given edge type.
 boolean isConnected(N n1, N n2)
          Checks whether two nodes in the graph are connected.
abstract  boolean isConnectedInDirection(N n1, E edgeValue, N n2)
          Checks whether two nodes in the graph are connected via a directed edge with the given value.
abstract  boolean isConnectedInDirection(N n1, N n2)
          Checks whether two nodes in the graph are connected via a directed edge.
 
Methods inherited from class com.google.javascript.jscomp.graph.Graph
clearEdgeAnnotations, clearNodeAnnotations, connect, connectIfNotFound, createNode, disconnect, getEdges, getEdges, getFirstEdge, getNeighborNodes, getNeighborNodesIterator, getNodeDegree, getNodes, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.javascript.jscomp.graph.AdjacencyGraph
getNode, newSubGraph
 

Constructor Detail

DiGraph

public DiGraph()
Method Detail

getDirectedGraphNodes

public abstract Iterable<DiGraph.DiGraphNode<N,E>> getDirectedGraphNodes()
Gets an immutable iterable over all the nodes in the graph.


getOutEdges

public abstract List<DiGraph.DiGraphEdge<N,E>> getOutEdges(N nodeValue)
Gets an immutable list of out edges of the given node.


getInEdges

public abstract List<DiGraph.DiGraphEdge<N,E>> getInEdges(N nodeValue)
Gets an immutable list of in edges of the given node.


getDirectedPredNodes

public abstract List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(DiGraph.DiGraphNode<N,E> n)

getDirectedSuccNodes

public abstract List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> n)

getDirectedPredNodes

public abstract List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(N nodeValue)

getDirectedSuccNodes

public abstract List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(N nodeValue)

createDirectedGraphNode

public abstract DiGraph.DiGraphNode<N,E> createDirectedGraphNode(N nodeValue)

getDirectedGraphNode

public abstract DiGraph.DiGraphNode<N,E> getDirectedGraphNode(N nodeValue)

getDirectedGraphEdges

public abstract List<DiGraph.DiGraphEdge<N,E>> getDirectedGraphEdges(N n1,
                                                                     N n2)

disconnectInDirection

public abstract void disconnectInDirection(N n1,
                                           N n2)
Disconnects all edges from n1 to n2.

Parameters:
n1 - Source node.
n2 - Destination node.

isConnectedInDirection

public abstract boolean isConnectedInDirection(N n1,
                                               N n2)
Checks whether two nodes in the graph are connected via a directed edge.

Parameters:
n1 - Node 1.
n2 - Node 2.
Returns:
true if the graph contains edge from n1 to n2.

isConnectedInDirection

public abstract boolean isConnectedInDirection(N n1,
                                               E edgeValue,
                                               N n2)
Checks whether two nodes in the graph are connected via a directed edge with the given value.

Parameters:
n1 - Node 1.
edgeValue - edge value tag
n2 - Node 2.
Returns:
true if the edge exists.

isConnected

public boolean isConnected(N n1,
                           N n2)
Description copied from class: Graph
Checks whether two nodes in the graph are connected.

Specified by:
isConnected in class Graph<N,E>
Parameters:
n1 - Node 1.
n2 - Node 2.
Returns:
true if the two nodes are connected.

isConnected

public boolean isConnected(N n1,
                           E e,
                           N n2)
Description copied from class: Graph
Checks whether two nodes in the graph are connected by the given edge type.

Specified by:
isConnected in class Graph<N,E>
Parameters:
n1 - Node 1.
e - The edge type.
n2 - Node 2.