public class GraphUtils
Constructor and Description |
---|
GraphUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
dump(List<Set<T>> list) |
static <T> void |
dump(Map<T,Set<T>> graph) |
static <T> List<Set<T>> |
getConnectedComponents(Map<T,Set<T>> graph)
Find connected components of the undirected graph.
|
static <T> List<Set<T>> |
getConnectedComponents(Set<T> nodes,
Set<Pair<T,T>> pairs) |
static void |
main(Rail<String> args) |
static <T> Map<T,Set<T>> |
toAdjacencySet(Set<T> nodes,
Set<Pair<T,T>> pairs)
Convert adjacency pairs to adjacency lists.
|
public static <T> Map<T,Set<T>> toAdjacencySet(Set<T> nodes, Set<Pair<T,T>> pairs)
public static <T> List<Set<T>> getConnectedComponents(Set<T> nodes, Set<Pair<T,T>> pairs)
public static <T> List<Set<T>> getConnectedComponents(Map<T,Set<T>> graph)
graph
- adjacency list (all nodes must be in the keys)public static <T> void dump(Map<T,Set<T>> graph)
public static <T> void dump(List<Set<T>> list)
public static void main(Rail<String> args)