Class ConflictGraph
java.lang.Object
org.unifi.mecvirtualresourceallocation.graph.ConflictGraph
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an edge between two vertices in the conflict graph.void
Adds a vertex to the conflict graph.boolean
areVerticesConnected
(Vertex vertex1, Vertex vertex2) Checks if two vertices are connected.getAdjacentVertices
(Vertex vertex) Retrieves the adjacent vertices for a given vertex.getEdges()
Gets the edges of the conflict graph.Retrieves a vertex from the conflict graph by its ID.Gets the vertices of the conflict graph.void
Saves the current conflict graph visualization as an SVG file.void
Displays the conflict graph using a graphical user interface.toString()
Returns a string representation of the conflict graph, including its vertices and edges.
-
Constructor Details
-
ConflictGraph
public ConflictGraph()Constructs an empty conflict graph.
-
-
Method Details
-
getVertices
Gets the vertices of the conflict graph.- Returns:
- the vertices
-
getVertexFromId
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
Adds a vertex to the conflict graph.- Parameters:
vertex
- the vertex to be added
-
addEdge
Adds an edge between two vertices in the conflict graph.- Parameters:
vertex1
- the first vertexvertex2
- the second vertex
-
getEdges
Gets the edges of the conflict graph.- Returns:
- the edges
-
areVerticesConnected
Checks if two vertices are connected.- Parameters:
vertex1
- the first vertexvertex2
- the second vertex- Returns:
- true if the vertices are connected, false otherwise
-
getAdjacentVertices
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
Returns a string representation of the conflict graph, including its vertices and edges. -
showGraph
public void showGraph()Displays the conflict graph using a graphical user interface. -
saveToSvg
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
-