N
- Value type that the graph node stores.E
- Value type that the graph edge stores.public final class LinkedUndirectedGraph<N,E> extends UndiGraph<N,E> implements GraphvizGraph
UndiGraph.UndiGraphEdge<N,E>, UndiGraph.UndiGraphNode<N,E>
Graph.GraphEdge<N,E>
GraphvizGraph.GraphvizEdge, GraphvizGraph.GraphvizNode
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<N,com.google.javascript.jscomp.graph.LinkedUndirectedGraph.LinkedUndirectedGraphNode<N,E>> |
nodes |
Modifier | Constructor and Description |
---|---|
protected |
LinkedUndirectedGraph(boolean useNodeAnnotations,
boolean useEdgeAnnotations) |
Modifier and Type | Method and Description |
---|---|
void |
connect(N srcValue,
E edgeValue,
N destValue)
Connects two nodes in the graph with an edge.
|
static <N,E> LinkedUndirectedGraph<N,E> |
create() |
GraphNode<N,E> |
createNode(N value)
Gets a node from the graph given a value.
|
UndiGraph.UndiGraphNode<N,E> |
createUndirectedGraphNode(N nodeValue) |
void |
disconnect(N srcValue,
N destValue)
Disconnects two nodes in the graph by removing all edges between them.
|
java.util.List<Graph.GraphEdge<N,E>> |
getEdges()
Gets an immutable list of all edges.
|
java.util.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.
|
java.util.List<GraphvizGraph.GraphvizEdge> |
getGraphvizEdges()
Retrieve a list of edges in the graph.
|
java.util.List<GraphvizGraph.GraphvizNode> |
getGraphvizNodes()
Retrieve a list of nodes in the graph.
|
java.lang.String |
getName()
Name of the graph.
|
java.util.List<GraphNode<N,E>> |
getNeighborNodes(N value)
Gets the neighboring nodes.
|
GraphNode<N,E> |
getNode(N value)
Gets a node from the graph given a value.
|
int |
getNodeCount() |
int |
getNodeDegree(N value)
Gets the degree of a node.
|
java.util.Collection<GraphNode<N,E>> |
getNodes()
Gets an immutable list of all nodes.
|
java.util.List<UndiGraph.UndiGraphEdge<N,E>> |
getUndirectedGraphEdges(N n1,
N n2) |
UndiGraph.UndiGraphNode<N,E> |
getUndirectedGraphNode(N nodeValue) |
java.util.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.
|
clearEdgeAnnotations, clearNodeAnnotations, connectIfNotFound, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotations
protected final java.util.Map<N,com.google.javascript.jscomp.graph.LinkedUndirectedGraph.LinkedUndirectedGraphNode<N,E>> nodes
protected LinkedUndirectedGraph(boolean useNodeAnnotations, boolean useEdgeAnnotations)
public SubGraph<N,E> newSubGraph()
AdjacencyGraph
newSubGraph
in interface AdjacencyGraph<N,E>
public static <N,E> LinkedUndirectedGraph<N,E> create()
public void connect(N srcValue, E edgeValue, N destValue)
Graph
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 java.util.List<GraphNode<N,E>> getNeighborNodes(N value)
Graph
getNeighborNodes
in class Graph<N,E>
value
- The node's value.public java.util.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 java.util.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 java.util.List<Graph.GraphEdge<N,E>> getEdges(N n1, N n2)
Graph
public java.util.List<Graph.GraphEdge<N,E>> getEdges()
Graph
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 java.util.List<GraphvizGraph.GraphvizEdge> getGraphvizEdges()
GraphvizGraph
getGraphvizEdges
in interface GraphvizGraph
public java.lang.String getName()
GraphvizGraph
getName
in interface GraphvizGraph
public java.util.List<GraphvizGraph.GraphvizNode> getGraphvizNodes()
GraphvizGraph
getGraphvizNodes
in interface GraphvizGraph
public boolean isDirected()
GraphvizGraph
isDirected
in interface GraphvizGraph
public java.util.Collection<GraphNode<N,E>> getNodes()
Graph
public int getNodeCount()
getNodeCount
in interface AdjacencyGraph<N,E>
getNodeCount
in class Graph<N,E>
Copyright © 2009-2020 Google. All Rights Reserved.