Class ConflictGraph

java.lang.Object
org.unifi.mecvirtualresourceallocation.graph.ConflictGraph

public class ConflictGraph extends Object
This class represents a conflict graph derived from a hypergraph. The conflict graph is used to model conflicts between hyperedges, where conflicts are defined by the presence of common vertices.
  • Constructor Details

    • ConflictGraph

      public ConflictGraph()
      Constructs an empty conflict graph.
  • Method Details

    • getVertices

      public Set<Vertex> getVertices()
      Gets the vertices of the conflict graph.
      Returns:
      the vertices
    • getVertexFromId

      public Vertex getVertexFromId(String id)
      Retrieves a vertex from the conflict graph by its ID.
      Parameters:
      id - the ID of the vertex to retrieve
      Returns:
      the vertex with the specified ID, or null if not found
    • addVertex

      public void addVertex(Vertex vertex)
      Adds a vertex to the conflict graph.
      Parameters:
      vertex - the vertex to be added
    • addEdge

      public void addEdge(Vertex vertex1, Vertex vertex2)
      Adds an edge between two vertices in the conflict graph.
      Parameters:
      vertex1 - the first vertex
      vertex2 - the second vertex
    • getEdges

      public Set<Edge> getEdges()
      Gets the edges of the conflict graph.
      Returns:
      the edges
    • areVerticesConnected

      public boolean areVerticesConnected(Vertex vertex1, Vertex vertex2)
      Checks if two vertices are connected.
      Parameters:
      vertex1 - the first vertex
      vertex2 - the second vertex
      Returns:
      true if the vertices are connected, false otherwise
    • getAdjacentVertices

      public Set<Vertex> getAdjacentVertices(Vertex vertex)
      Retrieves the adjacent vertices for a given vertex.
      Parameters:
      vertex - the vertex for which to find adjacent vertices
      Returns:
      a set of adjacent vertices
    • toString

      public String toString()
      Returns a string representation of the conflict graph, including its vertices and edges.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the conflict graph
    • showGraph

      public void showGraph()
      Displays the conflict graph using a graphical user interface.
    • saveToSvg

      public void saveToSvg(String filePath)
      Saves the current conflict graph visualization as an SVG file. The file is saved as "conflictgraph.svg" in the current directory.
      Parameters:
      filePath - The file path where the SVG file will be saved