Returns the set of nodes that are reachable from {@code node}. Specifically, it returns all nodes {@code v} such that there exists a path (a sequence of adjacent outgoing edges) starting at {@code node} and ending at {@code v}. This implementation includes {@code node} as the first element in the re
(Graph<N> graph, N node)
| 276 | * @since 33.1.0 (present with return type {@code Set} since 20.0) |
| 277 | */ |
| 278 | public static <N> ImmutableSet<N> reachableNodes(Graph<N> graph, N node) { |
| 279 | checkArgument(graph.nodes().contains(node), NODE_NOT_IN_GRAPH, node); |
| 280 | return ImmutableSet.copyOf(Traverser.forGraph(graph).breadthFirst(node)); |
| 281 | } |
| 282 | |
| 283 | // Graph mutation methods |
| 284 |
no test coverage detected