class AbstractHashGenerator {

    static int[][] toAdjList(IAtomContainer container) {

        if (container == null) throw new IllegalArgumentException("atom container was null");

        int n = container.getAtomCount();

        int[][] graph = new int[n][16];
        int[] degree = new int[n];

        for (IBond bond : container.bonds()) {

            int v = container.indexOf(bond.getBegin());
            int w = container.indexOf(bond.getEnd());

            if (v < 0 || w < 0)
                throw new IllegalArgumentException("bond at index " + container.indexOf(bond)
                        + " contained an atom not pressent in molecule");

            graph[v][degree[v]++] = w;
            graph[w][degree[w]++] = v;

            // if the vertex degree of v or w reaches capacity, double the size
            if (degree[v] == graph[v].length) graph[v] = Arrays.copyOf(graph[v], degree[v] * 2);
            if (degree[w] == graph[w].length) graph[w] = Arrays.copyOf(graph[w], degree[w] * 2);
        }

        for (int v = 0; v < n; v++) {
            graph[v] = Arrays.copyOf(graph[v], degree[v]);
        }

        return graph;

    }

    public  AbstractHashGenerator(Pseudorandom pseudorandom);

}