findUnreachable method

Set<String> findUnreachable(
  1. Set<String> entryPoints
)

Find nodes unreachable from the given entry points.

Entry points are typically main, routing, etc.

Implementation

Set<String> findUnreachable(Set<String> entryPoints) {
  final reachable = <String>{};

  for (final entry in entryPoints) {
    if (_nodes.containsKey(entry)) {
      reachable.add(entry);
      reachable.addAll(getDependencies(entry));
    }
  }

  return _nodes.keys.toSet().difference(reachable);
}