public class Graphs extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Graphs.DirectedEdge<V,E> |
static class |
Graphs.UndirectedEdge<V,E> |
Constructor and Description |
---|
Graphs() |
Modifier and Type | Method and Description |
---|---|
static <V> Set<V> |
articulationPoints(IGraph<V,?> graph) |
static <V> Iterable<V> |
bfsVertices(Iterable<V> start,
Function<V,Iterable<V>> adjacent) |
static <V> Iterable<V> |
bfsVertices(V start,
Function<V,Iterable<V>> adjacent) |
static <V> Set<Set<V>> |
biconnectedComponents(IGraph<V,?> graph) |
static <V> Set<Set<V>> |
connectedComponents(IGraph<V,?> graph) |
static <V,E> List<List<V>> |
cycles(IGraph<V,E> graph) |
static <V,E> boolean |
equals(IGraph<V,E> a,
IGraph<V,E> b) |
static <V,E> int |
hash(IGraph<V,E> g) |
static <V,E> IGraph<V,E> |
merge(IGraph<V,E> a,
IGraph<V,E> b,
BinaryOperator<E> merge) |
static <V,E> Optional<IList<V>> |
shortestPath(IGraph<V,E> graph,
Iterable<V> start,
Predicate<V> accept,
ToDoubleFunction<IEdge<V,E>> cost) |
static <V,E> Optional<IList<V>> |
shortestPath(IGraph<V,E> graph,
V start,
Predicate<V> accept,
ToDoubleFunction<IEdge<V,E>> cost) |
static <V,E> Set<Set<V>> |
stronglyConnectedComponents(IGraph<V,E> graph,
boolean includeSingletons) |
static <V,E> List<IGraph<V,E>> |
stronglyConnectedSubgraphs(IGraph<V,E> graph,
boolean includeSingletons) |
public static <V,E> int hash(IGraph<V,E> g)
public static <V,E> IGraph<V,E> merge(IGraph<V,E> a, IGraph<V,E> b, BinaryOperator<E> merge)
public static <V,E> Optional<IList<V>> shortestPath(IGraph<V,E> graph, V start, Predicate<V> accept, ToDoubleFunction<IEdge<V,E>> cost)
graph
- a graphstart
- the starting vertexaccept
- a predicate for whether a vertex represents a search end statecost
- the cost associated with each edgepublic static <V,E> Optional<IList<V>> shortestPath(IGraph<V,E> graph, Iterable<V> start, Predicate<V> accept, ToDoubleFunction<IEdge<V,E>> cost)
graph
- a graphstart
- a list of starting verticesaccept
- a predicate for whether a vertex represents a search end statecost
- the cost associated with each edgepublic static <V> Set<Set<V>> connectedComponents(IGraph<V,?> graph)
public static <V> Set<Set<V>> biconnectedComponents(IGraph<V,?> graph)
public static <V> Set<V> articulationPoints(IGraph<V,?> graph)
public static <V,E> Set<Set<V>> stronglyConnectedComponents(IGraph<V,E> graph, boolean includeSingletons)
graph
- a directed graphincludeSingletons
- if false, omits any singleton vertex setspublic static <V,E> List<IGraph<V,E>> stronglyConnectedSubgraphs(IGraph<V,E> graph, boolean includeSingletons)
graph
- a directed graphincludeSingletons
- if false, omits any subgraphs containing a single vertexpublic static <V,E> List<List<V>> cycles(IGraph<V,E> graph)
graph
- a directed graph