public class GraphUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <N,E> java.util.Set<Graph<N,E>> |
findClusters(Graph<N,E> graph)
Find the set of clusters in the graph.
|
static <N,E> java.util.Set<N> |
findNeighbors(Graph<N,E> graph,
N node)
Return all neighbors of a particular node in a graph.
|
static <N,E> GraphPath<N,E> |
findShortestPath(Graph<N,E> graph,
N startNode,
N endNode)
Find the shortest path from startNode to endNode.
|
static <N,E> GraphPath<N,E> |
findShortestPath(Graph<N,E> graph,
N startNode,
N endNode,
int maxLen)
Find the shortest path from startNode to endNode.
|
static <N,E> Tree<N> |
findSpanTree(Graph<N,E> graph,
N node)
Find the spanning tree for the associated graph, starting with the
specified node as the root.
|
public static <N,E> java.util.Set<Graph<N,E>> findClusters(Graph<N,E> graph)
N
- The node type for the graphE
- The edge type for the graphgraph
- the graph to searchpublic static <N,E> java.util.Set<N> findNeighbors(Graph<N,E> graph, N node)
N
- The node type for the graphE
- The edge type for the graphgraph
- the graph to searchnode
- the target nodepublic static <N,E> GraphPath<N,E> findShortestPath(Graph<N,E> graph, N startNode, N endNode)
N
- The node type for the graphE
- The edge type for the graphgraph
- the graph which should contain the edgestartNode
- the starting node of the pathendNode
- the ending node of the pathpublic static <N,E> GraphPath<N,E> findShortestPath(Graph<N,E> graph, N startNode, N endNode, int maxLen)
N
- The node type for the graphE
- The edge type for the graphgraph
- the graph which should contain the edgestartNode
- the starting node of the pathendNode
- the ending node of the pathmaxLen
- the maximum length for the path. The path length is the
number of edge segments in the pathpublic static <N,E> Tree<N> findSpanTree(Graph<N,E> graph, N node)
N
- The node type for the graphE
- The edge type for the graphgraph
- the graph to spannode
- the node to start the span from. This becomes the root of
the resulting tree.