|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg._3pq.jgrapht.GraphHelper
public final class GraphHelper
A collection of utilities to assist the working with graphs.
Method Summary | |
---|---|
static Edge |
addEdge(Graph g,
java.lang.Object sourceVertex,
java.lang.Object targetVertex,
double weight)
Creates a new edge and adds it to the specified graph similarly to the Graph.addEdge(Object, Object) method. |
static boolean |
addEdgeWithVertices(Graph g,
Edge e)
Adds the specified edge to the specified graph including its vertices. |
static Edge |
addEdgeWithVertices(Graph g,
java.lang.Object sourceVertex,
java.lang.Object 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 Edge |
addEdgeWithVertices(Graph g,
java.lang.Object sourceVertex,
java.lang.Object 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 boolean |
addGraph(Graph destination,
Graph source)
Adds all the vertices and all the edges of the specified source graph to the specified destination graph. |
static void |
addGraphReversed(DirectedGraph destination,
DirectedGraph 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 java.util.List |
neighborListOf(Graph g,
java.lang.Object vertex)
Returns a list of vertices that are the neighbors of a specified vertex. |
static java.util.List |
predecessorListOf(DirectedGraph g,
java.lang.Object vertex)
Returns a list of vertices that are the predecessors of a specified vertex. |
static java.util.List |
successorListOf(DirectedGraph g,
java.lang.Object vertex)
Returns a list of vertices that are the successors of a specified vertex. |
static UndirectedGraph |
undirectedGraph(Graph 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 |
Method Detail |
---|
public static Edge addEdge(Graph g, java.lang.Object sourceVertex, java.lang.Object 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 boolean addEdgeWithVertices(Graph g, Edge e)
g
- the graph for which the specified edge to be added.e
- the edge to be added to the graph (including its vertices).
true
if and only if the specified edge was not
already contained in the graph.public static Edge addEdgeWithVertices(Graph g, java.lang.Object sourceVertex, java.lang.Object 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 Edge addEdgeWithVertices(Graph g, java.lang.Object sourceVertex, java.lang.Object 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 boolean addGraph(Graph destination, Graph 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 void addGraphReversed(DirectedGraph destination, DirectedGraph source)
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.public static java.util.List neighborListOf(Graph g, java.lang.Object vertex)
g
- the graph to look for neighbors in.vertex
- the vertex to get the neighbors of.
public static java.util.List predecessorListOf(DirectedGraph g, java.lang.Object vertex)
g
- the graph to look for predecessors in.vertex
- the vertex to get the predecessors of.
public static java.util.List successorListOf(DirectedGraph g, java.lang.Object vertex)
g
- the graph to look for successors in.vertex
- the vertex to get the successors of.
public static UndirectedGraph undirectedGraph(Graph g)
g
- the graph for which an undirected view to be returned.
java.lang.IllegalArgumentException
- if the graph is neither DirectedGraph
nor UndirectedGraph.AsUndirectedGraph
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |