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

    • Method Detail

      • 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)
        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,​Set<Ex>> breakEdgesAt​(List<Ex> edgesToBreak,
                                                            V vertexToBreakAt,
                                                            org.opengis.referencing.crs.CoordinateReferenceSystem crs)
                                                     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).
        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
        Throws:
        PlanItException - thrown if error
      • breakEdgeAt

        <Ex extends E> Ex breakEdgeAt​(V vertexToBreakAt,
                                      Ex edgeToBreak,
                                      PlanitJtsCrsUtils geoUtils)
                               throws PlanItException
        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
        Throws:
        PlanItException - thrown if error
      • 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

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

        default <Ex extends EMap<Long,​Set<Ex>> breakEdgesAt​(List<Ex> 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). 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
        Throws:
        PlanItException - thrown if error
      • reset

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