MCPcopy Create free account
hub / github.com/antlr/codebuff / roots

Method roots

output/java_guava/1.4.17/GraphProperties.java:102–110  ·  view source on GitHub ↗

Returns the set of all nodes in graph that have no predecessors. Note that in an undirected graph, this is equivalent to all isolated nodes.

(Graph<N> graph)

Source from the content-addressed store, hash-verified

100
101
102 public static <N> ImmutableSet<N> roots(Graph<N> graph) {
103 ImmutableSet.Builder<N> builder = ImmutableSet.builder();
104 for (N node : graph.nodes()) {
105 if (graph.predecessors(node).isEmpty()) {
106 builder.add(node);
107 }
108 }
109 return builder.build();
110 }
111}

Callers

nothing calls this directly

Calls 6

builderMethod · 0.95
nodesMethod · 0.65
isEmptyMethod · 0.65
predecessorsMethod · 0.65
addMethod · 0.65
buildMethod · 0.45

Tested by

no test coverage detected