public class GraphUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GraphUtil.EdgeContractionRule
EdgeContractionRule is a callback for the contractVertices method.
|
| Constructor and Description |
|---|
GraphUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addEdge(Graph g,
Edge e)
Add an Edge to a Graph, converting Exceptions into RuntimeExceptions.
|
static void |
addEdge(Graph g,
Vertex v1,
Vertex v2)
Add an edge to a Graph, converting Exceptions into RuntimeExceptions.
|
static void |
addVertex(Graph g,
Vertex v)
Add a Vertex to a Graph, converting Exceptions into RuntimeExceptions.
|
static void |
contractVertices(Graph g,
Vertex vRemain,
Vertex vRemove,
GraphUtil.EdgeContractionRule rule)
Contract two vertices within a graph.
|
static boolean |
detectCycles(DirectedGraph graph) |
static void |
mergeInto(Graph gDst,
Graph gSrc)
Merge two graphs.
|
static void |
removeEdge(Graph g,
Edge e)
Remove an Edge from a Graph, converting Exceptions into
RuntimeExceptions.
|
static void |
removeVertex(Graph g,
Vertex v)
Remove a Vertex from a Graph, converting Exceptions into
RuntimeExceptions.
|
public static void mergeInto(Graph gDst, Graph gSrc)
gDst - one of the inputs, and also the output (receives the merged
result)gSrc - the other input (unmodified by this operation)public static void addVertex(Graph g, Vertex v)
g - the graph to be updatedv - the vertex to addpublic static void addEdge(Graph g, Edge e)
g - the graph to be updatede - the edge to addpublic static void addEdge(Graph g, Vertex v1, Vertex v2)
g - the graph to be updatedv1 - one of the vertices (the source if g is a DirectedGraph)v2 - the other vertex (the sink if g is a DirectedGraph)public static void removeVertex(Graph g, Vertex v)
g - the graph to be updatedv - the vertex to removepublic static void removeEdge(Graph g, Edge e)
g - the graph to be updatede - the edge to removepublic static void contractVertices(Graph g, Vertex vRemain, Vertex vRemove, GraphUtil.EdgeContractionRule rule)
g - the graph containing the verticesvRemain - the vertex which will remain in the graph after
contractionvRemove - the other vertex which will be removed as a result
of the contractionrule - callback object used to decide how to deal with edges;
if null, no edges are treated as self-loops, and the graph's factory is
used for cloning edgespublic static boolean detectCycles(DirectedGraph graph)
Copyright © 2019 JULIE Lab, Germany. All rights reserved.