Package graph
Klasse ExampleGraphs
java.lang.Object
graph.ExampleGraphs
Class containing example graphs for demonstration purposes.
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate void
addBidirectionalEdge
(DirectedGraph<VertexMarking, EdgeMarking> graph, MarkedVertex<VertexMarking> from, MarkedVertex<VertexMarking> to, EdgeWeightMarking weight) Helper method to add a bidirectional edge between two vertices in a graph.example1()
Creates an example graph suitable for demonstrating Dijkstra's and A* algorithms.example2()
Creates an example grid graph where each node is connected to its horizontal and vertical neighbors.example3()
Creates an example graph illustrating two paths from a start node to an end node with different characteristics: one path with few nodes and mostly low-weight edges, and another path with more nodes and higher-weight edges.example4()
Creates an example labyrinth graph with four horizontal paths, each consisting of four nodes.
-
Konstruktordetails
-
ExampleGraphs
public ExampleGraphs()
-
-
Methodendetails
-
example1
Creates an example graph suitable for demonstrating Dijkstra's and A* algorithms. This graph contains multiple nodes connected by weighted edges, allowing efficient calculation of shortest paths from a start node to an end node.- Gibt zurück:
- Directed graph instance for example 1.
-
example2
Creates an example grid graph where each node is connected to its horizontal and vertical neighbors. All edges have the same weight. The start node is in one corner of the grid, and the end node is in the opposite corner, demonstrating the efficiency of the A* algorithm in structured grid graphs.- Gibt zurück:
- Directed graph instance for example 2.
-
example3
Creates an example graph illustrating two paths from a start node to an end node with different characteristics: one path with few nodes and mostly low-weight edges, and another path with more nodes and higher-weight edges. The algorithms will alternate exploration between these paths.- Gibt zurück:
- Directed graph instance for example 3.
-
example4
Creates an example labyrinth graph with four horizontal paths, each consisting of four nodes. Each path leads to a respective endpoint, demonstrating how algorithms may explore potentially incorrect paths before finding the correct one, and showing the efficiency of A* in finding the correct path quickly.- Gibt zurück:
- Directed graph instance for example 4.
-
addBidirectionalEdge
private void addBidirectionalEdge(DirectedGraph<VertexMarking, EdgeMarking> graph, MarkedVertex<VertexMarking> from, MarkedVertex<VertexMarking> to, EdgeWeightMarking weight) Helper method to add a bidirectional edge between two vertices in a graph.- Parameter:
graph
- The graph instance where the edge should be added.from
- The starting vertex of the edge.to
- The ending vertex of the edge.weight
- The weight marking of the edge.
-