Returns a String of the adjacent node relationships for graph.
(final Graph<N> graph)
| 395 | * Returns a String of the adjacent node relationships for {@code graph}. |
| 396 | */ |
| 397 | private static <N> String adjacentNodesString(final Graph<N> graph) { |
| 398 | checkNotNull(graph, "graph"); |
| 399 | List<String> adjacencies = new ArrayList<String>(); |
| 400 | // This will list each undirected edge twice (once as [n1, n2] and once as [n2, n1]); this is OK |
| 401 | for (N node : graph.nodes()) { |
| 402 | for (N successor : graph.successors(node)) { |
| 403 | adjacencies.add( |
| 404 | String.format( |
| 405 | graph.isDirected() ? DIRECTED_FORMAT : UNDIRECTED_FORMAT, |
| 406 | node, successor)); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | return String.format("{%s}", Joiner.on(", ").join(adjacencies)); |
| 411 | } |
| 412 | |
| 413 | /** |
| 414 | * Returns a map that is a live view of {@code graph}, with nodes as keys |
no test coverage detected