0904358705
Revert "Für Christian" This reverts commit 213638ad1618f7f3a6e41f9a6226a4dfc1bce361. Revert "Visualisation progress" This reverts commit 12dbadf5e1c3b91a839fdb47c78a43f81353001c. Revert "OurApplication test"This reverts commit 6b0caa1a5e05aa55811556a1ba5264f595ddb375. Revert "Visualisation tests" This reverts commit cf63dddf51ea2489943e3de3839431b43b18878e.
33 lines
1.3 KiB
Java
33 lines
1.3 KiB
Java
package graph;
|
|
|
|
import java.util.Random;
|
|
|
|
public class Display {
|
|
|
|
public static void main(String[] args) {
|
|
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
|
|
}
|
|
Random random = new Random();
|
|
|
|
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
|
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
|
}
|
|
|
|
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
|
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
|
}
|
|
|
|
System.out.println(myGraph.toString());
|
|
|
|
MarkedVertex<VertexMarking> start = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
|
|
MarkedVertex<VertexMarking> end = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
|
|
System.out.println(start.getName() + " to " + end.getName());
|
|
|
|
System.out.println(myGraph.getShortestPathDijkstra(start, end));
|
|
|
|
}
|
|
}
|