Package graph
Klasse UndirectedGraph<T extends VertexMarking,U extends EdgeMarking>
java.lang.Object
graph.Graph<T,U>
graph.UndirectedGraph<T,U>
- Typparameter:
T
- Type of marking for vertices in the graph.U
- Type of marking for edges in the graph.
Represents an undirected graph with vertices marked by T and edges marked by U.
Inherits from the Graph class and provides additional functionality specific to undirected graphs.
-
Feldübersicht
-
Konstruktorübersicht
KonstruktorBeschreibungConstructs an empty undirected graph with default properties.Constructs an undirected graph with a specified name. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addEdge
(MarkedEdge<U> e) Adds an edge to the undirected graph and updates the associated visualization graph.void
addVertex
(MarkedVertex<T> n) Adds a vertex to the undirected graph and updates the associated visualization graph.int
degree
(MarkedVertex<T> n) Returns the degree of a specified vertex in the undirected graph.int
Returns the degree of a specified vertex by its name in the undirected graph.Retrieves the log list containing logging elements related to operations on this graph.Returns a vector containing all neighbors (adjacent vertices) of a specified vertex in the undirected graph.Retrieves the visualization graph associated with this undirected graph.Creates and retrieves a deep copy of the visualization graph associated with this undirected graph.double
getShortestPathAStar
(MarkedVertex<T> n1, MarkedVertex<T> n2) Computes the shortest path between two vertices using A* algorithm in the undirected graph.int
getShortestPathDijkstra
(MarkedVertex<T> n1, MarkedVertex<T> n2) Computes the shortest path between two vertices using Dijkstra's algorithm in the undirected graph.void
removeEdge
(MarkedEdge<U> e) Removes an edge from the undirected graph and updates the associated visualization graph.void
Removes a vertex from the undirected graph and updates the associated visualization graph.Von Klasse geerbte Methoden graph.Graph
areAdjacent, areAdjacent, clearScreenGraphColor, degree, getAllEdges, getAllVertexes, getName, hasEdge, hasEdge, hasEdge, hasEdge, hasLoop, hasLoop, hasVertex, hasVertex, numberOfEdges, numberOfVertexes, removeEdge, removeVertex, setName, toString
-
Felddetails
-
screenGraph
-
logList
-
-
Konstruktordetails
-
UndirectedGraph
public UndirectedGraph()Constructs an empty undirected graph with default properties. -
UndirectedGraph
Constructs an undirected graph with a specified name.- Parameter:
s
- The name of the graph.
-
-
Methodendetails
-
getScreenGraph
Retrieves the visualization graph associated with this undirected graph.- Angegeben von:
getScreenGraph
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Gibt zurück:
- The visualization graph.
-
getLogList
Retrieves the log list containing logging elements related to operations on this graph.- Angegeben von:
getLogList
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Gibt zurück:
- The log element list.
-
getScreenGraphCopy
Creates and retrieves a deep copy of the visualization graph associated with this undirected graph.- Gibt zurück:
- A deep copy of the visualization graph.
-
addEdge
Adds an edge to the undirected graph and updates the associated visualization graph.- Setzt außer Kraft:
addEdge
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
e
- The edge to be added.
-
addVertex
Adds a vertex to the undirected graph and updates the associated visualization graph.- Setzt außer Kraft:
addVertex
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
n
- The vertex to be added.
-
removeEdge
Removes an edge from the undirected graph and updates the associated visualization graph.- Setzt außer Kraft:
removeEdge
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
e
- The edge to be removed.
-
removeVertex
Removes a vertex from the undirected graph and updates the associated visualization graph.- Setzt außer Kraft:
removeVertex
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
n
- The vertex to be removed.
-
degree
Returns the degree of a specified vertex in the undirected graph. The degree of a vertex is the number of edges incident to it.- Parameter:
n
- The vertex for which to determine the degree.- Gibt zurück:
- The degree of the vertex.
-
degree
Returns the degree of a specified vertex by its name in the undirected graph.- Parameter:
s
- The name of the vertex for which to determine the degree.- Gibt zurück:
- The degree of the vertex.
- Löst aus:
NameDoesNotExistException
- If the vertex with the specified name does not exist in the graph.
-
getNeighbours
Returns a vector containing all neighbors (adjacent vertices) of a specified vertex in the undirected graph.- Parameter:
n
- The vertex for which to retrieve neighbors.- Gibt zurück:
- A vector of neighboring vertices.
-
getShortestPathDijkstra
Computes the shortest path between two vertices using Dijkstra's algorithm in the undirected graph.- Angegeben von:
getShortestPathDijkstra
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
n1
- The starting vertex of the shortest path.n2
- The ending vertex of the shortest path.- Gibt zurück:
- The length of the shortest path between n1 and n2.
-
getShortestPathAStar
Computes the shortest path between two vertices using A* algorithm in the undirected graph.- Angegeben von:
getShortestPathAStar
in KlasseGraph<T extends VertexMarking,
U extends EdgeMarking> - Parameter:
n1
- The starting vertex of the shortest path.n2
- The ending vertex of the shortest path.- Gibt zurück:
- The length of the shortest path between n1 and n2.
-