package graph; import java.awt.*; import java.util.Random; public class Display { public static void main(String[] args) { DirectedGraph myGraph = new DirectedGraph<>(); Random random = new Random(); for (int i = 0; i < 10; i++) { myGraph.addVertex(new MarkedVertex<>(random.nextInt(i, 350), random.nextInt(i, 350), String.valueOf(i) + " :", Color.BLACK , null)); } for (MarkedVertex i: myGraph.getAllVertexes()) { myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10))); } for (MarkedVertex 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 start = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())); MarkedVertex end = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())); System.out.println(start.getName() + " to " + end.getName()); System.out.println(myGraph.getShortestPathDijkstra(start, end)); } }