Returns a String of the adjacent node relationships for graph.
(final Graph<N> graph)
| 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 |
no test coverage detected