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

    • Method Detail

      • removeVertex

        void removeVertex​(V vertex)
        Remove a vertex by removing it from the graph and the edges it is connected to. Any registered events fro vertex removal will be triggered.
        Parameters:
        vertex - to remove
      • removeEdge

        void removeEdge​(E edge)
        Remove an edge by removing it from the graph and the vertices it is connected to. Any registered events for edge removal will be triggered.
        Parameters:
        edge - to remove
      • removeDanglingSubGraphs

        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
        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
      • removeSubGraph

        void removeSubGraph​(Set<? extends V> subGraphToRemove)
        remove the subgraph identified by the passed in vertices
        Parameters:
        subGraphToRemove - the one to remove
      • removeSubGraphOf

        void removeSubGraphOf​(V referenceVertex)
                       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
        Throws:
        PlanItException - thrown if error
      • breakEdgesAt

        <Ex extends EMap<Long,​Pair<Ex,​Ex>> breakEdgesAt​(List<Ex> edgesToBreak,
                                                                      V vertexToBreakAt,
                                                                      org.opengis.referencing.crs.CoordinateReferenceSystem crs)
        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).
        Type Parameters:
        Ex - edge type
        Parameters:
        edgesToBreak - the links to break
        vertexToBreakAt - the node to break at
        crs - required to update edge lengths
        Returns:
        affectedEdges the list of all result edges of the breaking of links by their original link id
      • breakEdgeAt

        <Ex extends E> Ex breakEdgeAt​(V vertexToBreakAt,
                                      Ex edgeToBreak,
                                      PlanitJtsCrsUtils geoUtils)
        Break the passed in edge by inserting the passed in vertex in between. After completion the original edge remains as (VertexA,VertexToBreakAt), and new edges are inserted for (VertexToBreakAt,VertexB).
        Type Parameters:
        Ex - edge type
        Parameters:
        edgeToBreak - the link to break
        vertexToBreakAt - the node to break at
        geoUtils - required to update edge lengths
        Returns:
        newlyCreatedEdge
      • recreateManagedEntitiesIds

        void recreateManagedEntitiesIds()
        This method will recreate all ids of the graph's components, e.g., vertices, edges, etc. but only when the containers used for them are the primary ManagedIdEntities containers, i.e., when the graph is responsible of uniquely tracking all entities by their managed id. If not, for example, if this is a subgraph reusing parts of the main graph, it will not recreate the ids.

        The reasoning is that if we would recreate ids of the container while the container does not contain all = let's say - vertices, their managedId is no longer guaranteed to be unique which can lead to issues

        Method can be used in conjunctions with the removal of parts of the graph and the result is required to have unique contiguous ids

        Should fire #RecreatedGraphEntitiesManagedIdsEvent after it has been executed

      • removeDanglingSubGraphs

        default void removeDanglingSubGraphs()
        remove any dangling sub graphs from the graph if they exist and reorder the ids if needed
      • breakEdgesAt

        default <Ex extends EMap<Long,​Pair<Ex,​Ex>> breakEdgesAt​(List<Ex> edgesToBreak,
                                                                              V vertexToBreakAt)
        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). No coordinate reference system provided, so we assume cartesian coordinates
        Type Parameters:
        Ex - edge type
        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
      • reset

        void reset()
        reset all state related information of the instance