public static void printGraph(Graph graph) {
        System.out.println("Graph has " + graph.n + " vertices and " + graph.m + " edge(s).");
        Node node;
        for (int i = 0; i < graph.n; i++) {
            System.out.print("Vertex " + (i + 1) + " has edge(s) with: ");
            node = graph.edges[i];
            if (null == node) {
                System.out.print("nobody");
            } else {
                while (null != node) {
                    System.out.print((node.vertex + 1) + "(" + node.weight + ") ");
                    node = node.next;
                }
            }
            System.out.println();
        }
    }