Package com.powsybl.openloadflow.graph
Interface GraphConnectivity<V,E>
- All Known Implementing Classes:
AbstractGraphConnectivity
,EvenShiloachGraphDecrementalConnectivity
,MinimumSpanningTreeGraphConnectivity
,NaiveGraphConnectivity
public interface GraphConnectivity<V,E>
Interface for incremental and decremental connectivity computations, through a mechanism which records the
topological changes which later need to be undone.
To start recording topological changes, call
startTemporaryChanges()
.
A call to undoTemporaryChanges()
will then undo in reverse order all the graph modifications which occurred since last
call to startTemporaryChanges()
.
This allows several levels of temporary changes - even if some implementations might not support it.
connectivity.addVertex(v1); connectivity.addVertex(v2); connectivity.addEdge(v1, v2, e12); connectivity.startTemporaryChanges(); connectivity.removeEdge(e12); connectivity.startTemporaryChanges(); connectivity.addVertex(v3); connectivity.addEdge(v1, v3, e13); connectivity.undoTemporaryChanges(); connectivity.undoTemporaryChanges();
- Author:
- Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>, Florian Dupuy <florian.dupuy at rte-france.com>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
int
getComponentNumber
(V vertex) Return the number of the connected component containing the given vertex, knowing that the number represents the size ranking of the related connected component in the graph, 0 being the main connected component.getConnectedComponent
(V vertex) Return the connected component set of given vertexReturn the edges which were added to main component by last temporary changes.Return the edges which were removed from main component by last temporary changes.int
Return the number of connected componentsReturn the vertices which were added to main component by last temporary changes.Return the vertices which were removed from main component by last temporary changes.void
removeEdge
(E edge) void
setMainComponentVertex
(V mainComponentVertex) Set the main component with given vertex.void
Start recording topological changes to undo them later by aundoTemporaryChanges()
call.boolean
void
Undo all the connectivity changes (possibly none) since last call tostartTemporaryChanges()
.
-
Method Details
-
addVertex
-
addEdge
-
removeEdge
-
supportTemporaryChangesNesting
boolean supportTemporaryChangesNesting() -
startTemporaryChanges
void startTemporaryChanges()Start recording topological changes to undo them later by aundoTemporaryChanges()
call. -
undoTemporaryChanges
void undoTemporaryChanges()Undo all the connectivity changes (possibly none) since last call tostartTemporaryChanges()
. -
getComponentNumber
Return the number of the connected component containing the given vertex, knowing that the number represents the size ranking of the related connected component in the graph, 0 being the main connected component. Hence, the greater the component number is, the smaller the number of vertices in that component.- Parameters:
vertex
- the vertex whose connected component number is looked for- Returns:
- the number of the related connected component
-
setMainComponentVertex
Set the main component with given vertex. The connected component relative to this vertex is considered as being the main component. If not set, the main component is considered to be the biggest component. This main component cannot be changed if any temporary changes are ongoing.- Parameters:
mainComponentVertex
- vertex defining main component
-
getNbConnectedComponents
int getNbConnectedComponents()Return the number of connected components -
getConnectedComponent
Return the connected component set of given vertex -
getVerticesRemovedFromMainComponent
Return the vertices which were removed from main component by last temporary changes. The main component is set by calling setMainComponentVertex, or if not set it is the biggest connected component. -
getEdgesRemovedFromMainComponent
Return the edges which were removed from main component by last temporary changes. The main component is set by calling setMainComponentVertex, or if not set it is the biggest connected component. -
getVerticesAddedToMainComponent
Return the vertices which were added to main component by last temporary changes. The main component is set by calling setMainComponentVertex, or if not set it is the biggest connected component. -
getEdgesAddedToMainComponent
Return the edges which were added to main component by last temporary changes. The main component is set by calling setMainComponentVertex, or if not set it is the biggest connected component.
-