a-foundation/src/main/java/com/ajjpj/afoundation/collection/graph/ADiGraph.java
public static <N, E extends AEdge<N>> ADiGraph<N,E> create (Collection<N> nodes, Collection<E> edges) {
        final Object[] nodeArr = new Object[nodes.size ()];
        final AEdge[] edgeArr = new AEdge[edges.size ()];

        int idx = 0;
        for (N node: nodes) {
            nodeArr[idx] = node;
            idx += 1;
        }

        idx = 0;
        for (E edge: edges) {
            edgeArr[idx] = edge;
            idx += 1;
        }

        return new ADiGraph<N,E> (nodeArr, edgeArr);
    }
public static <N, E extends AEdge<N>> ADiGraph<N,E> create (Collection<N> nodes, Collection<E> edges) {
        final Object[] nodeArr = new Object[nodes.size ()];
        final AEdge[] edgeArr = new AEdge[edges.size ()];

        int idx = 0;
        for (N node: nodes) {
            nodeArr[idx] = node;
            idx += 1;
        }

        idx = 0;
        for (E edge: edges) {
            edgeArr[idx] = edge;
            idx += 1;
        }

        return new ADiGraph<N,E> (nodeArr, edgeArr);
    }
This factory method creates a graph with the given nodes and edges. It expressly allows nodes that have no edges attached to them.