# ConnectedSubgraphFinder.h

    00001 /**********************************************************************
    00002  * $Id: ConnectedSubgraphFinder.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00008  * Copyright (C) 2005-2006 Refractions Research Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************/
    00016
    00017 #ifndef GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
    00018 #define GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
    00019
    00020 #include <geos/planargraph/PlanarGraph.h> // for inlines
    00021
    00022 #include <stack>
    00023 #include <vector>
    00024
    00025 // Forward declarations
    00026 namespace geos {
    00027         namespace planargraph {
    00028                 class PlanarGraph;
    00029                 class Subgraph;
    00030                 class Node;
    00031         }
    00032 }
    00033
    00034 namespace geos {
    00035 namespace planargraph { // geos::planargraph
    00036 namespace algorithm { // geos::planargraph::algorithm
    00037
    00043 class ConnectedSubgraphFinder
    00044 {
    00045 private:
    00046         PlanarGraph& graph;
    00047
    00049         Subgraph* findSubgraph(Node* node);
    00050
    00051
    00058         void addReachable(Node* node, Subgraph* subgraph);
    00059
    00065         void addEdges(Node* node, std::stack<Node *>& nodeStack,
    00066                         Subgraph* subgraph);
    00067
    00068 public:
    00069
    00070         ConnectedSubgraphFinder(PlanarGraph& newGraph)
    00071                 :
    00072                 graph(newGraph)
    00073                 {}
    00074
    00083         void getConnectedSubgraphs(std::vector<Subgraph *>& dest);
    00084
    00085 };
    00086
    00087 } // namespace geos::planargraph::algorithm
    00088 } // namespace geos::planargraph
    00089 } // namespace geos
    00090
    00091 #endif // GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
    00092