Class ConnectedSubgraphFinder


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

    Note: uses the isVisited flag on the nodes.

    • Constructor Detail

      • ConnectedSubgraphFinder

        public ConnectedSubgraphFinder​(PlanarGraph graph)
    • Method Detail

      • getConnectedSubgraphs

        public java.util.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,
                              java.util.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