Program Listing for File ComponentDecomposition.hpp

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

/*
 * ComponentDecomposition.hpp
 *
 *  Created on: 17.12.2020
 *      Author: cls,
 *              Eugenio Angriman <angrimae@hu-berlin.de>
 */

#ifndef NETWORKIT_COMPONENTS_COMPONENT_DECOMPOSITION_HPP_
#define NETWORKIT_COMPONENTS_COMPONENT_DECOMPOSITION_HPP_

#include <map>
#include <vector>

#include <networkit/base/Algorithm.hpp>
#include <networkit/graph/Graph.hpp>
#include <networkit/structures/Partition.hpp>

namespace NetworKit {

class ComponentDecomposition : public Algorithm {
public:
    ComponentDecomposition(const Graph &G);

    count numberOfComponents() const;

    count componentOfNode(node u) const;

    const Partition &getPartition() const;

    std::map<index, count> getComponentSizes() const;

    std::vector<std::vector<node>> getComponents() const;

protected:
    const Graph *G;
    Partition component;
};

} // namespace NetworKit

#endif // NETWORKIT_COMPONENTS_COMPONENT_DECOMPOSITION_HPP_