@@ -0,0 +1,1802 @@
+import java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0Apublic class CompleteGraphGenerator %7B%0A    private final int numOfVertices;%0A    private final int numOfEdges;%0A    private final List%3CInteger%3E randWeights;%0A    private final List%3CString%3E edges;%0A%0A    CompleteGraphGenerator(int numOfVertices) %7B%0A        this.numOfVertices = numOfVertices;%0A        numOfEdges = (numOfVertices * (numOfVertices - 1)) / 2;%0A        randWeights = new ArrayList%3C%3E(numOfEdges);%0A        edges = new ArrayList%3C%3E(numOfEdges);%0A%0A        createUniqueShuffledWeights();%0A        generateShuffledEdges();%0A    %7D%0A%0A    private void createUniqueShuffledWeights() %7B%0A        for (int weight = 1; weight %3C numOfEdges + 1; weight++)%0A            randWeights.add(weight);%0A%0A        Collections.shuffle(randWeights);%0A    %7D%0A%0A    private void generateShuffledEdges() %7B%0A        int weightIndex = 0;%0A%0A        for (int v1 = 1; v1 %3C numOfVertices + 1; v1++) %7B%0A            for (int v2 = v1; v2 %3C numOfVertices + 1; v2++) %7B%0A                if (v1 == v2)%0A                    continue;%0A%0A                String s = v1 + %22 %22 + v2 + %22 %22 + randWeights.get(weightIndex++);%0A                edges.add(s);%0A            %7D%0A        %7D%0A        Collections.shuffle(edges);%0A    %7D%0A%0A    public void printEdgeList() %7B%0A        Random r = new Random();%0A        int sourceVertex = r.nextInt(numOfVertices) + 1; //interval %5B1, numOfVertices%5D%0A        System.out.println(numOfVertices + %22 %22 + sourceVertex);%0A%0A        for (String edge : edges)%0A            System.out.println(edge);%0A%0A        System.out.println(0 + %22 %22 + 0 + %22 %22 + 0); // print sentinel%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        CompleteGraphGenerator cg = new CompleteGraphGenerator(Integer.valueOf(args%5B0%5D));%0A        cg.printEdgeList();%0A    %7D%0A%7D%0A

add complete graph generator program