Class ConnectedSubgraphFinder

java.lang.Object
org.locationtech.jts.planargraph.algorithm.ConnectedSubgraphFinder

public class ConnectedSubgraphFinder extends Object
Finds all connected Subgraphs of a PlanarGraph.

Note: uses the isVisited flag on the nodes.

  • Field Details

  • Constructor Details

    • ConnectedSubgraphFinder

      public ConnectedSubgraphFinder(PlanarGraph graph)
  • Method Details

    • getConnectedSubgraphs

      public List getConnectedSubgraphs()
    • findSubgraph

      private Subgraph findSubgraph(Node node)
    • addReachable

      private void addReachable(Node startNode, Subgraph subgraph)
      Adds all nodes and edges reachable from this node to the subgraph. Uses an explicit stack to avoid a large depth of recursion.
      Parameters:
      node - a node known to be in the subgraph
    • addEdges

      private void addEdges(Node node, Stack nodeStack, Subgraph subgraph)
      Adds the argument node and all its out edges to the subgraph.
      Parameters:
      node - the node to add
      nodeStack - the current set of nodes being traversed