package graph; import static java.awt.Color.black; public class Anwendung { public static void main(String[] args) { // Erstellen eines gerichteten Graphen DirectedGraph graph = new DirectedGraph<>(); // Erstellen und Hinzufügen von Knoten MarkedVertex vertexA = new MarkedVertex<>("A", new VertexMarking() { }, 10, 10, black); MarkedVertex vertexB = new MarkedVertex<>("B", new VertexMarking() { }, 10, 100, black); MarkedVertex vertexC = new MarkedVertex<>("C", new VertexMarking() { }, 100, 10, black); MarkedVertex vertexD = new MarkedVertex<>("D", new VertexMarking() { }, 600, 100, black); MarkedVertex vertexE = new MarkedVertex<>("E", new VertexMarking() { }, 100, 60, black); MarkedVertex vertexF = new MarkedVertex<>("F", new VertexMarking() { }, 160, 100, black); MarkedVertex vertexG = new MarkedVertex<>("G", new VertexMarking() { }, 100, 160, black); graph.addVertex(vertexA); graph.addVertex(vertexB); graph.addVertex(vertexC); graph.addVertex(vertexD); graph.addVertex(vertexE); graph.addVertex(vertexF); graph.addVertex(vertexG); // Erstellen und Hinzufügen von Kanten graph.addEdge(new MarkedEdge<>("Edge1", vertexA, vertexB, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge2", vertexB, vertexC, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge3", vertexC, vertexD, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge7", vertexC, vertexE, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge4", vertexD, vertexE, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge8", vertexD, vertexG, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge5", vertexE, vertexF, new EdgeMarking() { })); graph.addEdge(new MarkedEdge<>("Edge6", vertexF, vertexG, new EdgeMarking() { })); //System.out.println(graph.areStrongAdjacent("A", "B")); //System.out.println(graph.numberOfEdges()); System.out.println("Vorgänger von A"); System.out.println(graph.getPredecessors(vertexA)); System.out.println("Vorgänger von D"); System.out.println(graph.getPredecessors(vertexD)); System.out.println("Vorgänger von D"); System.out.println(graph.getSuccessors(vertexC)); System.out.println(graph.topSort(vertexA)); System.out.println(""); } }