MCPcopy Index your code
hub / github.com/antlr/codebuff / adjacentNodesString

Method adjacentNodesString

output/java_guava/1.4.17/Graphs.java:417–427  ·  view source on GitHub ↗

Returns a String of the adjacent node relationships for graph.

(final Graph<N> graph)

Source from the content-addressed store, hash-verified

415
416
417 private static <N> String adjacentNodesString(final Graph<N> graph) {
418 checkNotNull(graph, "graph");
419 List<String> adjacencies = new ArrayList<String>();
420 // This will list each undirected edge twice (once as [n1, n2] and once as [n2, n1]); this is OK
421 for (N node : graph.nodes()) {
422 for (N successor : graph.successors(node)) {
423 adjacencies.add(String.format(graph.isDirected() ? DIRECTED_FORMAT : UNDIRECTED_FORMAT, node, successor));
424 }
425 }
426 return String.format("{%s}", Joiner.on(", ").join(adjacencies));
427 }
428
429 /**
430 * Returns a map that is a live view of {@code graph}, with nodes as keys

Callers 1

toStringMethod · 0.95

Calls 8

onMethod · 0.95
nodesMethod · 0.65
successorsMethod · 0.65
addMethod · 0.65
isDirectedMethod · 0.65
checkNotNullMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected