public class GraphUtils
extends java.lang.Object
Constructor and Description |
---|
GraphUtils() |
Modifier and Type | Method and Description |
---|---|
static <V> void |
addAllVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
java.util.Set<V> vertices)
Add all of the vertices to the graph without any edges.
|
static <N> void |
addIncomingEdges(org.jgrapht.DirectedGraph<N,org.jgrapht.graph.DefaultEdge> graph,
N target,
java.util.Set<N> sources)
Add dependents on the give target vertex.
|
static <V> void |
addOutgoingEdges(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
V source,
java.util.Set<V> targets)
Add dependencies to the given source vertex.
|
static <V> void |
copyGraph(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> sourceGraph,
org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> targetGraph)
Copy the source graph into the target graph
|
static <V> java.util.Set<V> |
getIncomingVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
V target)
Fetch all of the dependents of the given target vertex
|
static <V> java.util.Set<V> |
getLeafVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph)
Find the leave vertices in the graph.
|
static <V> java.util.Set<V> |
getOutgoingVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
V source)
Fetch all of the dependencies of the given source vertex
|
static <V> void |
removeVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
java.util.Set<V> vertices)
Removes vertices from graph
|
static <V> void |
swapVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph,
java.util.Map<V,java.util.Set<V>> alternates)
replace the vertices in the graph with an alternate set of vertices.
|
public static <V> void swapVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, java.util.Map<V,java.util.Set<V>> alternates)
graph
- graph to be mutatedalternates
- alternate vertices to insert into the graph. map of vertices to their direct dependents.public static <V> void addAllVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, java.util.Set<V> vertices)
graph
- graph to be mutatedvertices
- vertices to addpublic static <V> void addOutgoingEdges(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, V source, java.util.Set<V> targets)
DirectedGraph
implementation.graph
- graph to be mutatedsource
- source vertex of the new edgestargets
- target vertices for the new edgespublic static <N> void addIncomingEdges(org.jgrapht.DirectedGraph<N,org.jgrapht.graph.DefaultEdge> graph, N target, java.util.Set<N> sources)
DirectedGraph
implementation.graph
- graph to be mutatedtarget
- target vertex for the new edgessources
- source vertices for the new edgespublic static <V> java.util.Set<V> getIncomingVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, V target)
public static <V> java.util.Set<V> getOutgoingVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, V source)
public static <V> void copyGraph(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> sourceGraph, org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> targetGraph)
public static <V> java.util.Set<V> getLeafVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph)
graph
- graph to searchpublic static <V> void removeVertices(org.jgrapht.DirectedGraph<V,org.jgrapht.graph.DefaultEdge> graph, java.util.Set<V> vertices)
graph
- raph to mutatevertices
- vertices to remove