Program Listing for File ConnectedComponents.hpp

Return to documentation for file (include/networkit/components/ConnectedComponents.hpp)

/*
 * ConnectedComponents.hpp
 *
 *  Created on: Dec 16, 2013
 *      Author: cls
 */

#ifndef NETWORKIT_COMPONENTS_CONNECTED_COMPONENTS_HPP_
#define NETWORKIT_COMPONENTS_CONNECTED_COMPONENTS_HPP_

#include <memory>

#include <networkit/components/ComponentDecomposition.hpp>

namespace NetworKit {

// pImpl
namespace ConnectedComponentsDetails {
template <bool>
class ConnectedComponentsImpl;
} // namespace ConnectedComponentsDetails

class ConnectedComponents final : public ComponentDecomposition {
public:
    /* Creates the ConnectedComponents class for graph @G.
     *
     * @param G The graph.
     */
    ConnectedComponents(const Graph &G);

    ~ConnectedComponents() override;

    /*
     * Computes the connected components of the input graph.
     */
    void run() override;

    static Graph extractLargestConnectedComponent(const Graph &G, bool compactGraph = false);

private:
    std::unique_ptr<ConnectedComponentsDetails::ConnectedComponentsImpl<false>> impl;
};

} // namespace NetworKit

#endif // NETWORKIT_COMPONENTS_CONNECTED_COMPONENTS_HPP_