N - Value type that the graph node stores.E - Value type that the graph edge stores.public class LinkedDirectedGraph<N,E> extends DiGraph<N,E> implements GraphvizGraph
This implementation favors directed graph operations inherited from
DirectedGraph.
Operations from Graph would tends to be slower.
| Modifier and Type | Class and Description |
|---|---|
static class |
LinkedDirectedGraph.LinkedDirectedGraphNode<N,E>
A directed graph node that stores outgoing edges and incoming edges as an
list within the node itself.
|
DiGraph.DiGraphEdge<N,E>, DiGraph.DiGraphNode<N,E>Graph.GraphEdge<N,E>GraphvizGraph.GraphvizEdge, GraphvizGraph.GraphvizNode| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<N,LinkedDirectedGraph.LinkedDirectedGraphNode<N,E>> |
nodes |
| Modifier | Constructor and Description |
|---|---|
protected |
LinkedDirectedGraph(boolean useNodeAnnotations,
boolean useEdgeAnnotations) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(DiGraph.DiGraphNode<N,E> src,
E edgeValue,
DiGraph.DiGraphNode<N,E> dest)
DiGraphNode look ups can be expensive for a large graph operation, prefer this
method if you have the DiGraphNode available.
|
void |
connect(N srcValue,
E edgeValue,
N destValue)
Connects two nodes in the graph with an edge.
|
void |
connectIfNotConnectedInDirection(N srcValue,
E edgeValue,
N destValue)
DiGraphNode look ups can be expensive for a large graph operation, prefer this
method if you have the DiGraphNode available.
|
static <N,E> LinkedDirectedGraph<N,E> |
create() |
LinkedDirectedGraph.LinkedDirectedGraphNode<N,E> |
createDirectedGraphNode(N nodeValue) |
DiGraph.DiGraphNode<N,E> |
createNode(N value)
Gets a node from the graph given a value.
|
static <N,E> LinkedDirectedGraph<N,E> |
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.
|
java.util.List<DiGraph.DiGraphEdge<N,E>> |
getDirectedGraphEdges(N n1,
N n2) |
DiGraph.DiGraphNode<N,E> |
getDirectedGraphNode(N nodeValue) |
java.lang.Iterable<DiGraph.DiGraphNode<N,E>> |
getDirectedGraphNodes()
Gets an immutable iterable over all the nodes in the graph.
|
java.util.List<DiGraph.DiGraphNode<N,E>> |
getDirectedPredNodes(DiGraph.DiGraphNode<N,E> dNode) |
java.util.List<DiGraph.DiGraphNode<N,E>> |
getDirectedPredNodes(N nodeValue) |
java.util.List<DiGraph.DiGraphNode<N,E>> |
getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> dNode) |
java.util.List<DiGraph.DiGraphNode<N,E>> |
getDirectedSuccNodes(N nodeValue) |
java.util.List<DiGraph.DiGraphEdge<N,E>> |
getEdges()
Gets an immutable list of all edges.
|
java.util.List<DiGraph.DiGraphEdge<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.util.List<DiGraph.DiGraphEdge<N,E>> |
getInEdges(N nodeValue)
Gets an immutable list of in edges of the given node.
|
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 nodeValue)
Gets a node from the graph given a value.
|
int |
getNodeCount() |
int |
getNodeDegree(N value)
Gets the degree of a node.
|
java.util.Collection<DiGraph.DiGraphNode<N,E>> |
getNodes()
Gets an immutable list of all nodes.
|
java.util.List<DiGraph.DiGraphEdge<N,E>> |
getOutEdges(N nodeValue)
Gets an immutable list of out edges of the given node.
|
boolean |
isConnectedInDirection(DiGraph.DiGraphNode<N,E> dNode1,
com.google.common.base.Predicate<E> edgeMatcher,
DiGraph.DiGraphNode<N,E> dNode2)
DiGraphNode look ups can be expensive for a large graph operation, prefer this
method if you have the DiGraphNodes available.
|
boolean |
isConnectedInDirection(N n1,
E edgeValue,
N n2)
DiGraphNode look ups can be expensive for a large graph operation, prefer the
version below that takes DiGraphNodes, if you have them available.
|
boolean |
isConnectedInDirection(N n1,
N n2)
DiGraphNode look ups can be expensive for a large graph operation, prefer the
version below that takes DiGraphNodes, if you have them available.
|
boolean |
isDirected()
Graph type.
|
SubGraph<N,E> |
newSubGraph()
Returns an empty SubGraph for this Graph.
|
isConnected, isConnectedclearEdgeAnnotations, clearNodeAnnotations, connectIfNotFound, getWeight, hasNode, popEdgeAnnotations, popNodeAnnotations, pushEdgeAnnotations, pushNodeAnnotationsprotected final java.util.Map<N,LinkedDirectedGraph.LinkedDirectedGraphNode<N,E>> nodes
protected LinkedDirectedGraph(boolean useNodeAnnotations,
boolean useEdgeAnnotations)
public SubGraph<N,E> newSubGraph()
AdjacencyGraphnewSubGraph in interface AdjacencyGraph<N,E>public static <N,E> LinkedDirectedGraph<N,E> createWithoutAnnotations()
public static <N,E> LinkedDirectedGraph<N,E> create()
public void connect(N srcValue, E edgeValue, N destValue)
Graphpublic void connect(DiGraph.DiGraphNode<N,E> src, E edgeValue, DiGraph.DiGraphNode<N,E> dest)
public void connectIfNotConnectedInDirection(N srcValue, E edgeValue, N destValue)
public void disconnect(N n1, N n2)
Graphdisconnect in class Graph<N,E>n1 - First node.n2 - Second node.public void disconnectInDirection(N srcValue, N destValue)
DiGraphdisconnectInDirection in class DiGraph<N,E>srcValue - Source node.destValue - Destination node.public java.lang.Iterable<DiGraph.DiGraphNode<N,E>> getDirectedGraphNodes()
DiGraphgetDirectedGraphNodes 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 java.util.List<DiGraph.DiGraphEdge<N,E>> getInEdges(N nodeValue)
DiGraphgetInEdges in class DiGraph<N,E>public java.util.List<DiGraph.DiGraphEdge<N,E>> getOutEdges(N nodeValue)
DiGraphgetOutEdges in class DiGraph<N,E>public LinkedDirectedGraph.LinkedDirectedGraphNode<N,E> createDirectedGraphNode(N nodeValue)
createDirectedGraphNode in class DiGraph<N,E>public java.util.List<DiGraph.DiGraphEdge<N,E>> getEdges(N n1, N n2)
Graphpublic java.util.List<DiGraph.DiGraphEdge<N,E>> getEdges()
Graphpublic Graph.GraphEdge<N,E> getFirstEdge(N n1, N n2)
GraphgetFirstEdge in class Graph<N,E>n1 - Node one.n2 - Node two.public DiGraph.DiGraphNode<N,E> createNode(N value)
GraphObject.equals.createNode in class Graph<N,E>value - The node's value.public java.util.List<DiGraph.DiGraphEdge<N,E>> getDirectedGraphEdges(N n1, N n2)
getDirectedGraphEdges in class DiGraph<N,E>public boolean isConnectedInDirection(N n1, N n2)
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)
isConnectedInDirection in class DiGraph<N,E>n1 - Node 1.edgeValue - edge value tagn2 - Node 2.true if the edge exists.public boolean isConnectedInDirection(DiGraph.DiGraphNode<N,E> dNode1, com.google.common.base.Predicate<E> edgeMatcher, DiGraph.DiGraphNode<N,E> dNode2)
public java.util.List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(N nodeValue)
getDirectedPredNodes in class DiGraph<N,E>public java.util.List<DiGraph.DiGraphNode<N,E>> getDirectedPredNodes(DiGraph.DiGraphNode<N,E> dNode)
getDirectedPredNodes in class DiGraph<N,E>public java.util.List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(N nodeValue)
getDirectedSuccNodes in class DiGraph<N,E>public java.util.List<DiGraph.DiGraphNode<N,E>> getDirectedSuccNodes(DiGraph.DiGraphNode<N,E> dNode)
getDirectedSuccNodes in class DiGraph<N,E>public java.util.List<GraphvizGraph.GraphvizEdge> getGraphvizEdges()
GraphvizGraphgetGraphvizEdges in interface GraphvizGraphpublic java.util.List<GraphvizGraph.GraphvizNode> getGraphvizNodes()
GraphvizGraphgetGraphvizNodes in interface GraphvizGraphpublic java.lang.String getName()
GraphvizGraphgetName in interface GraphvizGraphpublic boolean isDirected()
GraphvizGraphisDirected in interface GraphvizGraphpublic java.util.Collection<DiGraph.DiGraphNode<N,E>> getNodes()
Graphpublic int getNodeCount()
getNodeCount in interface AdjacencyGraph<N,E>getNodeCount in class Graph<N,E>public java.util.List<GraphNode<N,E>> getNeighborNodes(N value)
GraphgetNeighborNodes in class Graph<N,E>value - The node's value.Copyright © 2009-2019 Google. All Rights Reserved.