|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.javascript.jscomp.graph.Graph<N,E> com.google.javascript.jscomp.graph.UndiGraph<N,E> com.google.javascript.jscomp.graph.LinkedUndirectedGraph<N,E>
N
- Value type that the graph node stores.E
- Value type that the graph edge stores.public class LinkedUndirectedGraph<N,E>
An undirected graph using linked list within nodes to store edge information.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.javascript.jscomp.graph.UndiGraph |
---|
UndiGraph.UndiGraphEdge<N,E>, UndiGraph.UndiGraphNode<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.LinkedUndirectedGraph.LinkedUndirectedGraphNode<N,E>> |
nodes
|
Constructor Summary | |
---|---|
protected |
LinkedUndirectedGraph(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()
|
|
GraphNode<N,E> |
createNode(N value)
Gets a node from the graph given a value. |
|
UndiGraph.UndiGraphNode<N,E> |
createUndirectedGraphNode(N nodeValue)
|
|
static
|
createWithEdgeAnnotations()
|
|
static
|
createWithNodeAnnotations()
|
|
static
|
createWithoutAnnotations()
|
|
void |
disconnect(N srcValue,
N destValue)
Disconnects two nodes in the graph by removing all edges between them. |
|
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. |
|
Graph.GraphEdge<N,E> |
getFirstEdge(N n1,
N n2)
Retrieves any 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. |
|
String |
getName()
Name of the graph. |
|
List<GraphNode<N,E>> |
getNeighborNodes(N value)
Gets the neighboring nodes. |
|
Iterator<GraphNode<N,E>> |
getNeighborNodesIterator(N value)
|
|
GraphNode<N,E> |
getNode(N value)
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<UndiGraph.UndiGraphEdge<N,E>> |
getUndirectedGraphEdges(N n1,
N n2)
|
|
UndiGraph.UndiGraphNode<N,E> |
getUndirectedGraphNode(N nodeValue)
|
|
Collection<UndiGraph.UndiGraphNode<N,E>> |
getUndirectedGraphNodes()
Gets an immutable collection of all the nodes in this graph. |
|
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. |
|
boolean |
isDirected()
Graph type. |
|
SubGraph<N,E> |
newSubGraph()
Returns an empty SubGraph for this Graph. |
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.LinkedUndirectedGraph.LinkedUndirectedGraphNode<N,E>> nodes
Constructor Detail |
---|
protected LinkedUndirectedGraph(boolean useNodeAnnotations, boolean useEdgeAnnotations)
Method Detail |
---|
public SubGraph<N,E> newSubGraph()
AdjacencyGraph
newSubGraph
in interface AdjacencyGraph<N,E>
public static <N,E> LinkedUndirectedGraph<N,E> createWithoutAnnotations()
public static <N,E> LinkedUndirectedGraph<N,E> createWithNodeAnnotations()
public static <N,E> LinkedUndirectedGraph<N,E> createWithEdgeAnnotations()
public static <N,E> LinkedUndirectedGraph<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 srcValue, N destValue)
Graph
disconnect
in class Graph<N,E>
srcValue
- First node.destValue
- Second node.public UndiGraph.UndiGraphNode<N,E> createUndirectedGraphNode(N nodeValue)
public List<GraphNode<N,E>> getNeighborNodes(N value)
Graph
getNeighborNodes
in class Graph<N,E>
value
- The node's value.
public Iterator<GraphNode<N,E>> getNeighborNodesIterator(N value)
getNeighborNodesIterator
in class Graph<N,E>
public List<UndiGraph.UndiGraphEdge<N,E>> getUndirectedGraphEdges(N n1, N n2)
public UndiGraph.UndiGraphNode<N,E> getUndirectedGraphNode(N nodeValue)
getUndirectedGraphNode
in class UndiGraph<N,E>
public Collection<UndiGraph.UndiGraphNode<N,E>> getUndirectedGraphNodes()
UndiGraph
public GraphNode<N,E> createNode(N value)
Graph
Object.equals
.
createNode
in class Graph<N,E>
value
- The node's value.
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 Graph.GraphEdge<N,E> getFirstEdge(N n1, N n2)
Graph
getFirstEdge
in class Graph<N,E>
n1
- Node one.n2
- Node two.
public GraphNode<N,E> getNode(N value)
AdjacencyGraph
Object.equals
.
getNode
in interface AdjacencyGraph<N,E>
value
- The node's value.
public boolean isConnected(N n1, N n2)
Graph
isConnected
in class Graph<N,E>
n1
- Node 1.n2
- Node 2.
true
if the two nodes are connected.public boolean isConnected(N n1, E e, N n2)
Graph
isConnected
in class Graph<N,E>
n1
- Node 1.e
- The edge type.n2
- Node 2.public List<GraphvizGraph.GraphvizEdge> getGraphvizEdges()
GraphvizGraph
getGraphvizEdges
in interface GraphvizGraph
public String getName()
GraphvizGraph
getName
in interface GraphvizGraph
public List<GraphvizGraph.GraphvizNode> getGraphvizNodes()
GraphvizGraph
getGraphvizNodes
in interface GraphvizGraph
public boolean isDirected()
GraphvizGraph
isDirected
in interface GraphvizGraph
public Collection<GraphNode<N,E>> getNodes()
Graph
getNodes
in interface AdjacencyGraph<N,E>
getNodes
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 |