|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgrapht.Graphs
public abstract class Graphs
A collection of utilities to assist with graph manipulation.
| Constructor Summary | |
|---|---|
Graphs()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAllEdges(Graph<? super V,? super E> destination,
Graph<V,E> source,
java.util.Collection<? extends E> edges)
Adds a subset of the edges of the specified source graph to the specified destination graph. |
|
static
|
addAllVertices(Graph<? super V,? super E> destination,
java.util.Collection<? extends V> vertices)
Adds all of the specified vertices to the destination graph. |
|
static
|
addEdge(Graph<V,E> g,
V sourceVertex,
V targetVertex,
double weight)
Creates a new edge and adds it to the specified graph similarly to the Graph.addEdge(Object, Object) method. |
|
static
|
addEdgeWithVertices(Graph<V,E> targetGraph,
Graph<V,E> sourceGraph,
E edge)
Adds the specified edge to the graph, including its vertices if not already included. |
|
static
|
addEdgeWithVertices(Graph<V,E> g,
V sourceVertex,
V targetVertex)
Adds the specified source and target vertices to the graph, if not already included, and creates a new edge and adds it to the specified graph similarly to the Graph.addEdge(Object, Object) method. |
|
static
|
addEdgeWithVertices(Graph<V,E> g,
V sourceVertex,
V targetVertex,
double weight)
Adds the specified source and target vertices to the graph, if not already included, and creates a new weighted edge and adds it to the specified graph similarly to the Graph.addEdge(Object, Object)
method. |
|
static
|
addGraph(Graph<? super V,? super E> destination,
Graph<V,E> source)
Adds all the vertices and all the edges of the specified source graph to the specified destination graph. |
|
static
|
addGraphReversed(DirectedGraph<? super V,? super E> destination,
DirectedGraph<V,E> source)
Adds all the vertices and all the edges of the specified source digraph to the specified destination digraph, reversing all of the edges. |
|
static
|
getOppositeVertex(Graph<V,E> g,
E e,
V v)
Gets the vertex opposite another vertex across an edge. |
|
static
|
getPathVertexList(GraphPath<V,E> path)
Gets the list of vertices visited by a path. |
|
static
|
neighborListOf(Graph<V,E> g,
V vertex)
Returns a list of vertices that are the neighbors of a specified vertex. |
|
static
|
predecessorListOf(DirectedGraph<V,E> g,
V vertex)
Returns a list of vertices that are the direct predecessors of a specified vertex. |
|
static
|
successorListOf(DirectedGraph<V,E> g,
V vertex)
Returns a list of vertices that are the direct successors of a specified vertex. |
|
static
|
testIncidence(Graph<V,E> g,
E e,
V v)
Tests whether an edge is incident to a vertex. |
|
static
|
undirectedGraph(Graph<V,E> g)
Returns an undirected view of the specified graph. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Graphs()
| Method Detail |
|---|
public static <V,E> E addEdge(Graph<V,E> g,
V sourceVertex,
V targetVertex,
double weight)
Graph.addEdge(Object, Object) method.
g - the graph for which the edge to be added.sourceVertex - source vertex of the edge.targetVertex - target vertex of the edge.weight - weight of the edge.
null.Graph.addEdge(Object, Object)
public static <V,E> E addEdgeWithVertices(Graph<V,E> g,
V sourceVertex,
V targetVertex)
Graph.addEdge(Object, Object) method.
g - the graph for which the specified edge to be added.sourceVertex - source vertex of the edge.targetVertex - target vertex of the edge.
null.
public static <V,E> boolean addEdgeWithVertices(Graph<V,E> targetGraph,
Graph<V,E> sourceGraph,
E edge)
targetGraph - the graph for which the specified edge to be added.sourceGraph - the graph in which the specified edge is already
presentedge - edge to add
public static <V,E> E addEdgeWithVertices(Graph<V,E> g,
V sourceVertex,
V targetVertex,
double weight)
Graph.addEdge(Object, Object)
method.
g - the graph for which the specified edge to be added.sourceVertex - source vertex of the edge.targetVertex - target vertex of the edge.weight - weight of the edge.
null.
public static <V,E> boolean addGraph(Graph<? super V,? super E> destination,
Graph<V,E> source)
true
if the destination graph has been modified as a result of this operation,
otherwise it returns false.
The behavior of this operation is undefined if any of the specified graphs is modified while operation is in progress.
destination - the graph to which vertices and edges are added.source - the graph used as source for vertices and edges to add.
true if and only if the destination graph has been
changed as a result of this operation.
public static <V,E> void addGraphReversed(DirectedGraph<? super V,? super E> destination,
DirectedGraph<V,E> source)
EdgeReversedGraph instead.
The behavior of this operation is undefined if any of the specified graphs is modified while operation is in progress.
destination - the graph to which vertices and edges are added.source - the graph used as source for vertices and edges to add.EdgeReversedGraph
public static <V,E> boolean addAllEdges(Graph<? super V,? super E> destination,
Graph<V,E> source,
java.util.Collection<? extends E> edges)
addEdgeWithVertices(org.jgrapht.Graph, V, V) is used for the transfer, so source vertexes will
be added automatically to the target graph.
destination - the graph to which edges are to be addedsource - the graph used as a source for edges to addedges - the edges to be added
public static <V,E> boolean addAllVertices(Graph<? super V,? super E> destination,
java.util.Collection<? extends V> vertices)
Graph.addVertex(Object) method.
destination - the graph to which edges are to be addedvertices - the vertices to be added to the graph.
java.lang.NullPointerException - if the specified vertices contains one or
more null vertices, or if the specified vertex collection is
null.Graph.addVertex(Object)
public static <V,E> java.util.List<V> neighborListOf(Graph<V,E> g,
V vertex)
g - the graph to look for neighbors in.vertex - the vertex to get the neighbors of.
public static <V,E> java.util.List<V> predecessorListOf(DirectedGraph<V,E> g,
V vertex)
g - the graph to look for predecessors in.vertex - the vertex to get the predecessors of.
public static <V,E> java.util.List<V> successorListOf(DirectedGraph<V,E> g,
V vertex)
g - the graph to look for successors in.vertex - the vertex to get the successors of.
public static <V,E> UndirectedGraph<V,E> undirectedGraph(Graph<V,E> g)
g - the graph for which an undirected view is to be returned.
java.lang.IllegalArgumentException - if the graph is neither DirectedGraph
nor UndirectedGraph.AsUndirectedGraph
public static <V,E> boolean testIncidence(Graph<V,E> g,
E e,
V v)
g - graph containing e and ve - edge in gv - vertex in g
public static <V,E> V getOppositeVertex(Graph<V,E> g,
E e,
V v)
g - graph containing e and ve - edge in gv - vertex in g
public static <V,E> java.util.List<V> getPathVertexList(GraphPath<V,E> path)
path - path of interest
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||