Interface GraphModifier<V extends Vertex,​E extends Edge>

  • All Known Implementing Classes:
    DirectedGraphImpl, GraphImpl

    public interface GraphModifier<V extends Vertex,​E extends Edge>
    Modify network elements based on chosen network view.
    Author:
    markr
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Map<Long,​Set<E>> breakEdgesAt​(List<? extends E> edgesToBreak, V vertexToBreakAt)
      Break the passed in edges by inserting the passed in vertex in between.
      void recreateIds()
      this method will recreate all ids of the graph's main components, e.g., vertices, edges, and potentially other eligible components of derived graph implementations.
      default void removeDanglingSubGraphs()
      remove any dangling sub graphs from the graph if they exist and reorder the ids if needed
      void removeDanglingSubGraphs​(Integer belowSize, Integer aboveSize, boolean alwaysKeepLargest)
      remove any dangling subgraphs below a given size from the graph if they exist and subsequently reorder the internal ids if needed
      void removeSubGraph​(Set<? extends V> subGraphToRemove, boolean recreateIds)
      remove the subgraph identified by the passed in vertices
      void removeSubGraphOf​(V referenceVertex, boolean recreateIds)
      remove the (sub)graph in which the passed in vertex resides.
    • Method Detail

      • removeDanglingSubGraphs

        default void removeDanglingSubGraphs()
                                      throws PlanItException
        remove any dangling sub graphs from the graph if they exist and reorder the ids if needed
        Throws:
        PlanItException - thrown if error
      • removeDanglingSubGraphs

        void removeDanglingSubGraphs​(Integer belowSize,
                                     Integer aboveSize,
                                     boolean alwaysKeepLargest)
                              throws PlanItException
        remove any dangling subgraphs below a given size from the graph if they exist and subsequently reorder the internal ids if needed
        Parameters:
        belowSize - remove subgraphs below the given size
        aboveSize - remove subgraphs above the given size (typically set to maximum value)
        alwaysKeepLargest - indicate if the largest of the subgraphs is always to be kept even if it does not match the criteria
        Throws:
        PlanItException - thrown if error
      • removeSubGraph

        void removeSubGraph​(Set<? extends V> subGraphToRemove,
                            boolean recreateIds)
        remove the subgraph identified by the passed in vertices
        Parameters:
        subGraphToRemove - the one to remove
        recreateIds - indicate if the ids of the graph entities are to be recreated, if false gaps will occur so it is expected to be handled by the user afterwards in this case
      • removeSubGraphOf

        void removeSubGraphOf​(V referenceVertex,
                              boolean recreateIds)
                       throws PlanItException
        remove the (sub)graph in which the passed in vertex resides. Apply reordering of internal ids of remaining network.
        Parameters:
        referenceVertex - to identify subnetwork by
        recreateIds - indicate if the ids of the graph entities are to be recreated, if false gaps will occur so it is expected to be handled by the user afterwards in this case
        Throws:
        PlanItException - thrown if error
      • breakEdgesAt

        Map<Long,​Set<E>> breakEdgesAt​(List<? extends E> edgesToBreak,
                                            V vertexToBreakAt)
                                     throws PlanItException
        Break the passed in edges by inserting the passed in vertex in between. After completion the original edges remain as (VertexA,VertexToBreakAt), and new edges are inserted for (VertexToBreakAt,VertexB).
        Parameters:
        edgesToBreak - the links to break
        vertexToBreakAt - the node to break at
        Returns:
        affectedEdges the list of all result edges of the breaking of links by their original link id
        Throws:
        PlanItException - thrown if error
      • recreateIds

        void recreateIds()
        this method will recreate all ids of the graph's main components, e.g., vertices, edges, and potentially other eligible components of derived graph implementations. Can be used in conjunctions with the removal of subgraphs in case the recreation of ids was switched off manually for some reason.