Class DiGraph<N,E>
java.lang.Object
com.google.javascript.jscomp.graph.Graph<N,E>
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
A generic directed graph.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA generic directed graph edge.static interfaceA generic directed graph node.Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.Graph
Graph.GraphEdge<N,E> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DiGraph.DiGraphNode<N, E> createNode(N nodeValue) Gets a node from the graph given a value.abstract voiddisconnectInDirection(N n1, N n2) Disconnects all edges from n1 to n2.abstract List<? extends DiGraph.DiGraphNode<N, E>> abstract List<? extends DiGraph.DiGraphNode<N, E>> getDirectedPredNodes(N nodeValue) abstract List<? extends DiGraph.DiGraphNode<N, E>> abstract List<? extends DiGraph.DiGraphNode<N, E>> getDirectedSuccNodes(N nodeValue) abstract List<? extends DiGraph.DiGraphEdge<N, E>> getEdges()Gets an immutable list of all edges.abstract List<? extends DiGraph.DiGraphEdge<N, E>> Retrieves an edge from the graph.abstract List<? extends DiGraph.DiGraphEdge<N, E>> getEdgesInDirection(N n1, N n2) abstract List<? extends DiGraph.DiGraphEdge<N, E>> getInEdges(N nodeValue) Gets an immutable list of in edges of the given node.abstract DiGraph.DiGraphNode<N, E> Gets a node from the graph given a value.abstract Collection<? extends DiGraph.DiGraphNode<N, E>> getNodes()Gets an immutable list of all nodes.abstract List<? extends DiGraph.DiGraphEdge<N, E>> getOutEdges(N nodeValue) Gets an immutable list of out edges of the given node.booleanisConnected(N n1, E e, N n2) Checks whether two nodes in the graph are connected by the given edge type.booleanisConnected(N n1, N n2) Checks whether two nodes in the graph are connected.abstract booleanisConnectedInDirection(N n1, E edgeValue, N n2) Checks whether two nodes in the graph are connected via a directed edge with the given value.abstract booleanisConnectedInDirection(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, disconnect, getFirstEdge, getNeighborNodes, getNodeCount, getNodeDegree, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotationsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.javascript.jscomp.graph.AdjacencyGraph
newSubGraph
-
Constructor Details
-
DiGraph
public DiGraph()
-
-
Method Details
-
createNode
Description copied from class:GraphGets a node from the graph given a value. New nodes are created if that value has not been assigned a graph node. Values equality are compared usingObject.equals.- Specified by:
createNodein classGraph<N,E> - Parameters:
nodeValue- The node's value.- Returns:
- The corresponding node in the graph.
-
getNodes
Description copied from class:GraphGets an immutable list of all nodes. -
getNode
Description copied from interface:AdjacencyGraphGets a node from the graph given a value. Values equality are compared usingObject.equals.- Parameters:
nodeValue- The node's value.- Returns:
- The corresponding node in the graph, null if there value has no corresponding node.
-
getEdges
Description copied from class:GraphGets an immutable list of all edges. -
getEdges
Description copied from class:GraphRetrieves an edge from the graph. -
getEdgesInDirection
-
getOutEdges
Gets an immutable list of out edges of the given node. -
getInEdges
Gets an immutable list of in edges of the given node. -
getDirectedPredNodes
public abstract List<? extends DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(DiGraph.DiGraphNode<N, E> n) -
getDirectedPredNodes
-
getDirectedSuccNodes
public abstract List<? extends DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(DiGraph.DiGraphNode<N, E> n) -
getDirectedSuccNodes
-
disconnectInDirection
Disconnects all edges from n1 to n2.- Parameters:
n1- Source node.n2- Destination node.
-
isConnectedInDirection
Checks whether two nodes in the graph are connected via a directed edge.- Parameters:
n1- Node 1.n2- Node 2.- Returns:
trueif the graph contains edge from n1 to n2.
-
isConnectedInDirection
Checks whether two nodes in the graph are connected via a directed edge with the given value.- Parameters:
n1- Node 1.edgeValue- edge value tagn2- Node 2.- Returns:
trueif the edge exists.
-
isConnected
Description copied from class:GraphChecks whether two nodes in the graph are connected.- Specified by:
isConnectedin classGraph<N,E> - Parameters:
n1- Node 1.n2- Node 2.- Returns:
trueif the two nodes are connected.
-
isConnected
Description copied from class:GraphChecks whether two nodes in the graph are connected by the given edge type.- Specified by:
isConnectedin classGraph<N,E> - Parameters:
n1- Node 1.e- The edge type.n2- Node 2.
-