Class AbstractGraphConnectivity<V,E>

java.lang.Object
com.powsybl.openloadflow.graph.AbstractGraphConnectivity<V,E>
All Implemented Interfaces:
GraphConnectivity<V,E>
Direct Known Subclasses:
EvenShiloachGraphDecrementalConnectivity, MinimumSpanningTreeGraphConnectivity, NaiveGraphConnectivity

public abstract class AbstractGraphConnectivity<V,E> extends Object implements GraphConnectivity<V,E>
Author:
Florian Dupuy <florian.dupuy at rte-france.com>
  • Field Details

    • componentSets

      protected List<Set<V>> componentSets
  • Constructor Details

    • AbstractGraphConnectivity

      public AbstractGraphConnectivity()
  • Method Details

    • updateConnectivity

      protected abstract void updateConnectivity(EdgeRemove<V,E> edgeRemove)
    • updateConnectivity

      protected abstract void updateConnectivity(EdgeAdd<V,E> edgeAdd)
    • updateConnectivity

      protected abstract void updateConnectivity(VertexAdd<V,E> vertexAdd)
    • resetConnectivity

      protected abstract void resetConnectivity(Deque<GraphModification<V,E>> m)
    • updateComponents

      protected abstract void updateComponents()
    • addVertex

      public void addVertex(V vertex)
      Specified by:
      addVertex in interface GraphConnectivity<V,E>
    • addEdge

      public void addEdge(V vertex1, V vertex2, E edge)
      Specified by:
      addEdge in interface GraphConnectivity<V,E>
    • removeEdge

      public void removeEdge(E edge)
      Specified by:
      removeEdge in interface GraphConnectivity<V,E>
    • startTemporaryChanges

      public void startTemporaryChanges()
      Description copied from interface: GraphConnectivity
      Start recording topological changes to undo them later by a GraphConnectivity.undoTemporaryChanges() call.
      Specified by:
      startTemporaryChanges in interface GraphConnectivity<V,E>
    • undoTemporaryChanges

      public void undoTemporaryChanges()
      Description copied from interface: GraphConnectivity
      Undo all the connectivity changes (possibly none) since last call to GraphConnectivity.startTemporaryChanges().
      Specified by:
      undoTemporaryChanges in interface GraphConnectivity<V,E>
    • getComponentNumber

      public int getComponentNumber(V vertex)
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      getComponentNumber in interface GraphConnectivity<V,E>
      Parameters:
      vertex - the vertex whose connected component number is looked for
      Returns:
      the number of the related connected component
    • getQuickComponentNumber

      protected abstract int getQuickComponentNumber(V vertex)
    • getNbConnectedComponents

      public int getNbConnectedComponents()
      Description copied from interface: GraphConnectivity
      Return the number of connected components
      Specified by:
      getNbConnectedComponents in interface GraphConnectivity<V,E>
    • getSmallComponents

      protected Collection<Set<V>> getSmallComponents()
    • getConnectedComponent

      public Set<V> getConnectedComponent(V vertex)
      Description copied from interface: GraphConnectivity
      Return the connected component set of given vertex
      Specified by:
      getConnectedComponent in interface GraphConnectivity<V,E>
    • getNonConnectedVertices

      protected Set<V> getNonConnectedVertices(V vertex)
    • getGraph

      public org.jgrapht.Graph<V,E> getGraph()
    • getModificationsContexts

      protected Deque<ModificationsContext<V,E>> getModificationsContexts()
    • checkSavedContext

      protected ModificationsContext<V,E> checkSavedContext()
    • checkVertex

      protected void checkVertex(V vertex)
    • getVerticesAddedToMainComponent

      public Set<V> getVerticesAddedToMainComponent()
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      getVerticesAddedToMainComponent in interface GraphConnectivity<V,E>
    • getEdgesAddedToMainComponent

      public Set<E> getEdgesAddedToMainComponent()
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      getEdgesAddedToMainComponent in interface GraphConnectivity<V,E>
    • getVerticesRemovedFromMainComponent

      public Set<V> getVerticesRemovedFromMainComponent()
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      getVerticesRemovedFromMainComponent in interface GraphConnectivity<V,E>
    • getEdgesRemovedFromMainComponent

      public Set<E> getEdgesRemovedFromMainComponent()
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      getEdgesRemovedFromMainComponent in interface GraphConnectivity<V,E>
    • setMainComponentVertex

      public void setMainComponentVertex(V mainComponentVertex)
      Description copied from interface: GraphConnectivity
      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.
      Specified by:
      setMainComponentVertex in interface GraphConnectivity<V,E>
      Parameters:
      mainComponentVertex - vertex defining main component