a-foundation/src/main/java/com/ajjpj/afoundation/collection/graph/ADiGraph.java
public static <N, E extends AEdge<N>> ADiGraph<N,E> create (Collection<E> edges) {
        final Set<N> result = new HashSet<> ();
        for (E edge: edges) {
            result.add (edge.getFrom ());
            result.add (edge.getTo ());
        }

        return create (result, edges);
    }
public static <N, E extends AEdge<N>> ADiGraph<N,E> create (Collection<E> edges) {
        final Set<N> result = new HashSet<> ();
        for (E edge: edges) {
            result.add (edge.getFrom ());
            result.add (edge.getTo ());
        }

        return create (result, edges);
    }
This is a convenience factory method that extracts the list of nodes from the edges. It assumes that every node has at least one
edge going from or to it.