| Modifier and Type | Method and Description |
|---|---|
static <V> Set<V> |
collectAllConnected(Graph<? extends V> graph,
Collection<? extends V> startNodes)
Returns the transitively connected all vertices from the starting vertices.
|
static <V> Set<V> |
collectHeads(Graph<? extends V> graph)
Returns each head vertex in the graph, which has no preceding vertices.
|
static <V> Set<V> |
collectNearest(Graph<? extends V> graph,
Collection<? extends V> startNodes,
Predicate<? super V> matcher)
Returns the succeeding nearest vertices which match the condition, from the starting vertices,
and vertices on their routes.
|
static <V> Set<V> |
collectTails(Graph<? extends V> graph)
Returns each tail vertex in the graph, which has no succeeding vertices.
|
static <V> Graph<V> |
copy(Graph<? extends V> graph)
Returns a copy of the target graph.
|
static <V> Set<Set<V>> |
findCircuit(Graph<? extends V> graph)
Returns the all cyclic sub-graphs in the target graph.
|
static <V> Set<V> |
findNearest(Graph<? extends V> graph,
Collection<? extends V> startNodes,
Predicate<? super V> matcher)
Returns the succeeding nearest vertices which match the condition, from the starting vertices.
|
static <V> Set<Set<V>> |
findStronglyConnectedComponents(Graph<? extends V> graph)
Returns the all strongly connected components in the target graph.
|
static <V> Graph<V> |
newInstance()
Creates a new
Graph instance without any vertices. |
static <V> List<V> |
sortPostOrder(Graph<? extends V> graph)
Sorts the vertices from the tail to head topologically, and returns their list.
|
static <V> Graph<V> |
subgraph(Graph<? extends V> graph,
Predicate<? super V> matcher)
Creates a new subgraph from the target graph.
|
static <V> Graph<V> |
transpose(Graph<V> graph)
Creates a new transposed graph from the target graph.
|
public static <V> Graph<V> newInstance()
Graph instance without any vertices.V - the vertex value typepublic static <V> Graph<V> copy(Graph<? extends V> graph)
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Set<V> collectHeads(Graph<? extends V> graph)
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Set<V> collectTails(Graph<? extends V> graph)
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Set<V> collectAllConnected(Graph<? extends V> graph, Collection<? extends V> startNodes)
V - the vertex value typegraph - the target graphstartNodes - the starting verticesIllegalArgumentException - if the parameters are nullpublic static <V> Set<V> findNearest(Graph<? extends V> graph, Collection<? extends V> startNodes, Predicate<? super V> matcher)
collectAllConnected(graph, startNodes).contains(nearest))
matcher rule (matcher.test(nearest))
The resulting set may not contain the starting vertices, excepts the starting vertices also satisfies above the conditions.
V - the vertex value typegraph - the target graphstartNodes - the starting verticesmatcher - the matcherIllegalArgumentException - if the parameters are nullpublic static <V> Set<V> collectNearest(Graph<? extends V> graph, Collection<? extends V> startNodes, Predicate<? super V> matcher)
findNearest(Graph, Collection, Predicate). The resulting set may not contain the starting vertices,
excepts the starting vertices also on their searching route.V - the vertex value typegraph - the target graphstartNodes - the starting verticesmatcher - the vertices predicateIllegalArgumentException - if the parameters are nullpublic static <V> Set<Set<V>> findCircuit(Graph<? extends V> graph)
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Set<Set<V>> findStronglyConnectedComponents(Graph<? extends V> graph)
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> List<V> sortPostOrder(Graph<? extends V> graph)
graph does not contain any cycles, the resulting result must satisfy the following:
for i = 0..list.size-1:
for j = i+1..list.size-1:
assert graph.isConnected(list[i], list[j]) == false;
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Graph<V> transpose(Graph<V> graph)
graph.contains(a) <=> reverse.contains(a), and
graph.isConnected(a, b) <=> reverse.isConnected(b, a).
V - the vertex value typegraph - the target graphIllegalArgumentException - if the parameter is nullpublic static <V> Graph<V> subgraph(Graph<? extends V> graph, Predicate<? super V> matcher)
V - the vertex value typegraph - the target graphmatcher - only test to the subgraph membersIllegalArgumentException - if the parameters are nullCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.