Skip to content
Snippets Groups Projects
Commit c258b85b authored by TOUMERT Said's avatar TOUMERT Said
Browse files

Mon commit daté

parent dbd09d2e
Branches master
No related tags found
No related merge requests found
package GraphClasses;
import Graph.*;
import java.util.ArrayList;
import java.util.Collections;
public class Lollipop {
public Graph graph;
public Lollipop(int order) {
graph = new Graph(order);
ArrayList<Integer> permutation = new ArrayList<>(order);
for (int i = 0; i < order; i++)
permutation.add(i);
Collections.shuffle(permutation);
int t = order / 3;
for (int i = 0; i < t; i++)
graph.addEdge(new Edge(permutation.get(i),permutation.get(i+1),0));
for (int i = t; i < order; i++)
for (int j = i+1; j < order; j++)
graph.addEdge(new Edge(permutation.get(i),
permutation.get(j),
0
)
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment