Returns a function that transforms an edge into a string representation of its incident nodes in graph. The function's apply method will throw an IllegalArgumentException if graph does not contain edge.
(final Network<?, ?> graph)
| 465 | |
| 466 | |
| 467 | private static Function<Object, String> edgeToIncidentNodesString(final Network<?, ?> graph) { |
| 468 | if (graph.isDirected()) { |
| 469 | return new Function<Object, String>() { |
| 470 | @Override |
| 471 | public String apply(Object edge) { |
| 472 | return String.format("<%s -> %s>", graph.source(edge), graph.target(edge)); |
| 473 | } |
| 474 | }; |
| 475 | } |
| 476 | return new Function<Object, String>() { |
| 477 | @Override |
| 478 | public String apply(Object edge) { |
| 479 | return graph.incidentNodes(edge).toString(); |
| 480 | } |
| 481 | }; |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Returns a string representation of the properties of {@code graph}. |