com.google.javascript.jscomp.graph
Interface AdjacencyGraph<N,E>

Type Parameters:
N - Value type that the graph node stores.
E - Value type that the graph edge stores.
All Known Implementing Classes:
DiGraph, Graph, LinkedDirectedGraph, LinkedUndirectedGraph, UndiGraph

public interface AdjacencyGraph<N,E>

A minimal graph interface. Provided is add nodes to the graph, adjacency calculation between a SubGraph and a GraphNode, and adding node annotations.

For a more extensive interface, see Graph.

See Also:
Graph

Method Summary
 void clearNodeAnnotations()
          Makes each node's annotation null.
 GraphNode<N,E> getNode(N value)
          Gets a node from the graph given a value.
 Collection<GraphNode<N,E>> getNodes()
          Gets an immutable list of all nodes.
 int getWeight(N value)
          Returns a weight for the given value to be used in ordering nodes, e.g.
 SubGraph<N,E> newSubGraph()
          Returns an empty SubGraph for this Graph.
 

Method Detail

getNodes

Collection<GraphNode<N,E>> getNodes()
Gets an immutable list of all nodes.


getNode

GraphNode<N,E> getNode(N value)
Gets a node from the graph given a value. Values equality are compared using Object.equals.

Parameters:
value - The node's value.
Returns:
The corresponding node in the graph, null if there value has no corresponding node.

newSubGraph

SubGraph<N,E> newSubGraph()
Returns an empty SubGraph for this Graph.


clearNodeAnnotations

void clearNodeAnnotations()
Makes each node's annotation null.


getWeight

int getWeight(N value)
Returns a weight for the given value to be used in ordering nodes, e.g. in GraphColoring.