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.

public class UndirectedGraph<T extends VertexMarking,U extends EdgeMarking> extends Graph<T,U>
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.
  • Felddetails

  • Konstruktordetails

    • UndirectedGraph

      public UndirectedGraph()
      Constructs an empty undirected graph with default properties.
    • UndirectedGraph

      public UndirectedGraph(String s)
      Constructs an undirected graph with a specified name.
      Parameter:
      s - The name of the graph.
  • Methodendetails

    • getScreenGraph

      public Graph getScreenGraph()
      Retrieves the visualization graph associated with this undirected graph.
      Angegeben von:
      getScreenGraph in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Gibt zurück:
      The visualization graph.
    • getLogList

      public LogElementList<OurLogElement> getLogList()
      Retrieves the log list containing logging elements related to operations on this graph.
      Angegeben von:
      getLogList in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Gibt zurück:
      The log element list.
    • getScreenGraphCopy

      public Graph 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

      public void addEdge(MarkedEdge<U> e)
      Adds an edge to the undirected graph and updates the associated visualization graph.
      Setzt außer Kraft:
      addEdge in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Parameter:
      e - The edge to be added.
    • addVertex

      public void addVertex(MarkedVertex<T> n)
      Adds a vertex to the undirected graph and updates the associated visualization graph.
      Setzt außer Kraft:
      addVertex in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Parameter:
      n - The vertex to be added.
    • removeEdge

      public void removeEdge(MarkedEdge<U> e)
      Removes an edge from the undirected graph and updates the associated visualization graph.
      Setzt außer Kraft:
      removeEdge in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Parameter:
      e - The edge to be removed.
    • removeVertex

      public void removeVertex(MarkedVertex<T> n)
      Removes a vertex from the undirected graph and updates the associated visualization graph.
      Setzt außer Kraft:
      removeVertex in Klasse Graph<T extends VertexMarking,U extends EdgeMarking>
      Parameter:
      n - The vertex to be removed.
    • degree

      public int degree(MarkedVertex<T> n)
      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

      public int degree(String s) throws NameDoesNotExistException
      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

      public Vector<MarkedVertex<T>> getNeighbours(MarkedVertex<T> n)
      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

      public int getShortestPathDijkstra(MarkedVertex<T> n1, MarkedVertex<T> n2)
      Computes the shortest path between two vertices using Dijkstra's algorithm in the undirected graph.
      Angegeben von:
      getShortestPathDijkstra in Klasse Graph<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

      public double getShortestPathAStar(MarkedVertex<T> n1, MarkedVertex<T> n2)
      Computes the shortest path between two vertices using A* algorithm in the undirected graph.
      Angegeben von:
      getShortestPathAStar in Klasse Graph<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.