|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.javascript.jscomp.graph.Graph<N,E>
com.google.javascript.jscomp.graph.DiGraph<N,E>
com.google.javascript.jscomp.graph.LinkedDirectedGraph<N,E>
N - Value type that the graph node stores.E - Value type that the graph edge stores.public class LinkedDirectedGraph<N,E>
A directed graph using linked list within nodes to store edge information.
This implementation favors directed graph operations inherited from
DirectedGraph.
Operations from Graph would tends to be slower.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.DiGraph |
|---|
DiGraph.DiGraphEdge<N,E>, DiGraph.DiGraphNode<N,E> |
| Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.Graph |
|---|
Graph.GraphEdge<N,E> |
| Nested classes/interfaces inherited from interface com.google.javascript.jscomp.graph.GraphvizGraph |
|---|
GraphvizGraph.GraphvizEdge, GraphvizGraph.GraphvizNode |
| Field Summary | |
|---|---|
protected Map<N,com.google.javascript.jscomp.graph.LinkedDirectedGraph.LinkedDirectedGraphNode<N,E>> |
nodes
|
| Constructor Summary | |
|---|---|
protected |
LinkedDirectedGraph(boolean useNodeAnnotations,
boolean useEdgeAnnotations)
|
| Method Summary | ||
|---|---|---|
void |
connect(N srcValue,
E edgeValue,
N destValue)
Connects two nodes in the graph with an edge. |
|
static
|
create()
|
|
DiGraph.DiGraphNode<N,E> |
createDirectedGraphNode(N nodeValue)
|
|
GraphNode<N,E> |
createNode(N value)
Gets a node from the graph given a value. |
|
static
|
createWithEdgeAnnotations()
|
|
static
|
createWithNodeAnnotations()
|
|
static
|
createWithoutAnnotations()
|
|
void |
disconnect(N n1,
N n2)
Disconnects two nodes in the graph by removing all edges between them. |
|
void |
disconnectInDirection(N srcValue,
N destValue)
Disconnects all edges from n1 to n2. |
|
List<DiGraph.DiGraphEdge<N,E>> |
getDirectedGraphEdges(N n1,
N n2)
|
|
DiGraph.DiGraphNode<N,E> |
getDirectedGraphNode(N nodeValue)
|
|
Iterable<DiGraph.DiGraphNode<N,E>> |
getDirectedGraphNodes()
Gets an immutable iterable over all the nodes in the graph. |
|
List<DiGraph.DiGraphNode<N,E>> |
getDirectedPredNodes(DiGraph.DiGraphNode<N,E> dNode)
|
|
List<DiGraph.DiGraphNode<N,E>> |
getDirectedPredNodes(N nodeValue)
|
|
List<DiGraph.DiGraphNode<N,E>> |
getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> dNode)
|
|
List<DiGraph.DiGraphNode<N,E>> |
getDirectedSuccNodes(N nodeValue)
|
|
List<Graph.GraphEdge<N,E>> |
getEdges()
Gets an immutable list of all edges. |
|
List<Graph.GraphEdge<N,E>> |
getEdges(N n1,
N n2)
Retrieves an edge from the graph. |
|
List<GraphvizGraph.GraphvizEdge> |
getGraphvizEdges()
Retrieve a list of edges in the graph. |
|
List<GraphvizGraph.GraphvizNode> |
getGraphvizNodes()
Retrieve a list of nodes in the graph. |
|
List<DiGraph.DiGraphEdge<N,E>> |
getInEdges(N nodeValue)
Gets an immutable list of in edges of the given node. |
|
String |
getName()
Name of the graph. |
|
List<GraphNode<N,E>> |
getNeighborNodes(DiGraph.DiGraphNode<N,E> node)
|
|
List<GraphNode<N,E>> |
getNeighborNodes(N value)
Gets the neighboring nodes. |
|
Iterator<GraphNode<N,E>> |
getNeighborNodesIterator(N value)
|
|
GraphNode<N,E> |
getNode(N nodeValue)
Gets a node from the graph given a value. |
|
int |
getNodeDegree(N value)
Gets the degree of a node. |
|
Collection<GraphNode<N,E>> |
getNodes()
Gets an immutable list of all nodes. |
|
List<DiGraph.DiGraphEdge<N,E>> |
getOutEdges(N nodeValue)
Gets an immutable list of out edges of the given node. |
|
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. |
|
boolean |
isConnectedInDirection(N n1,
N n2)
Checks whether two nodes in the graph are connected via a directed edge. |
|
boolean |
isDirected()
Graph type. |
|
SubGraph<N,E> |
newSubGraph()
Returns an empty SubGraph for this Graph. |
|
| Methods inherited from class com.google.javascript.jscomp.graph.DiGraph |
|---|
isConnected, isConnected |
| Methods inherited from class com.google.javascript.jscomp.graph.Graph |
|---|
clearEdgeAnnotations, clearNodeAnnotations, connectIfNotFound, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Map<N,com.google.javascript.jscomp.graph.LinkedDirectedGraph.LinkedDirectedGraphNode<N,E>> nodes
| Constructor Detail |
|---|
protected LinkedDirectedGraph(boolean useNodeAnnotations,
boolean useEdgeAnnotations)
| Method Detail |
|---|
public SubGraph<N,E> newSubGraph()
AdjacencyGraph
newSubGraph in interface AdjacencyGraph<N,E>public static <N,E> LinkedDirectedGraph<N,E> createWithoutAnnotations()
public static <N,E> LinkedDirectedGraph<N,E> createWithNodeAnnotations()
public static <N,E> LinkedDirectedGraph<N,E> createWithEdgeAnnotations()
public static <N,E> LinkedDirectedGraph<N,E> create()
public void connect(N srcValue,
E edgeValue,
N destValue)
Graph
connect in class Graph<N,E>srcValue - First node.edgeValue - The edge.destValue - Second node.
public void disconnect(N n1,
N n2)
Graph
disconnect in class Graph<N,E>n1 - First node.n2 - Second node.
public void disconnectInDirection(N srcValue,
N destValue)
DiGraph
disconnectInDirection in class DiGraph<N,E>srcValue - Source node.destValue - Destination node.public Iterable<DiGraph.DiGraphNode<N,E>> getDirectedGraphNodes()
DiGraph
getDirectedGraphNodes in class DiGraph<N,E>public DiGraph.DiGraphNode<N,E> getDirectedGraphNode(N nodeValue)
getDirectedGraphNode in class DiGraph<N,E>public GraphNode<N,E> getNode(N nodeValue)
AdjacencyGraphObject.equals.
getNode in interface AdjacencyGraph<N,E>nodeValue - The node's value.
public List<DiGraph.DiGraphEdge<N,E>> getInEdges(N nodeValue)
DiGraph
getInEdges in class DiGraph<N,E>public List<DiGraph.DiGraphEdge<N,E>> getOutEdges(N nodeValue)
DiGraph
getOutEdges in class DiGraph<N,E>public DiGraph.DiGraphNode<N,E> createDirectedGraphNode(N nodeValue)
createDirectedGraphNode in class DiGraph<N,E>
public List<Graph.GraphEdge<N,E>> getEdges(N n1,
N n2)
Graph
getEdges in class Graph<N,E>n1 - Node one.n2 - Node two.
public GraphNode<N,E> createNode(N value)
GraphObject.equals.
createNode in class Graph<N,E>value - The node's value.
public List<DiGraph.DiGraphEdge<N,E>> getDirectedGraphEdges(N n1,
N n2)
getDirectedGraphEdges in class DiGraph<N,E>
public boolean isConnectedInDirection(N n1,
N n2)
DiGraph
isConnectedInDirection in class DiGraph<N,E>n1 - Node 1.n2 - Node 2.
true if the graph contains edge from n1 to n2.
public boolean isConnectedInDirection(N n1,
E edgeValue,
N n2)
DiGraph
isConnectedInDirection in class DiGraph<N,E>n1 - Node 1.edgeValue - edge value tagn2 - Node 2.
true if the edge exists.public List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(N nodeValue)
getDirectedPredNodes in class DiGraph<N,E>public List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(N nodeValue)
getDirectedSuccNodes in class DiGraph<N,E>public List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(DiGraph.DiGraphNode<N,E> dNode)
getDirectedPredNodes in class DiGraph<N,E>public List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> dNode)
getDirectedSuccNodes in class DiGraph<N,E>public List<GraphvizGraph.GraphvizEdge> getGraphvizEdges()
GraphvizGraph
getGraphvizEdges in interface GraphvizGraphpublic List<GraphvizGraph.GraphvizNode> getGraphvizNodes()
GraphvizGraph
getGraphvizNodes in interface GraphvizGraphpublic String getName()
GraphvizGraph
getName in interface GraphvizGraphpublic boolean isDirected()
GraphvizGraph
isDirected in interface GraphvizGraphpublic Collection<GraphNode<N,E>> getNodes()
Graph
getNodes in interface AdjacencyGraph<N,E>getNodes in class Graph<N,E>public List<GraphNode<N,E>> getNeighborNodes(N value)
Graph
getNeighborNodes in class Graph<N,E>value - The node's value.
public List<GraphNode<N,E>> getNeighborNodes(DiGraph.DiGraphNode<N,E> node)
public Iterator<GraphNode<N,E>> getNeighborNodesIterator(N value)
getNeighborNodesIterator in class Graph<N,E>public List<Graph.GraphEdge<N,E>> getEdges()
Graph
getEdges in class Graph<N,E>public int getNodeDegree(N value)
Graph
getNodeDegree in class Graph<N,E>value - The node's value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||