Program Listing for File Assortativity.hpp

Return to documentation for file (include/networkit/correlation/Assortativity.hpp)

/*
 * Assortativity.hpp
 *
 *  Created on: Jun 13, 2015
 *      Author: Christian Staudt
 */

#ifndef NETWORKIT_CORRELATION_ASSORTATIVITY_HPP_
#define NETWORKIT_CORRELATION_ASSORTATIVITY_HPP_

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

namespace NetworKit {

class Assortativity final : public Algorithm {

public:
    Assortativity(const Graph &G, const std::vector<double> &attribute);

    Assortativity(const Graph &G, const Partition &partition);

    void run() override;

    double getCoefficient() const;

private:
    const Graph *G;
    const std::vector<double> emptyVector;
    const Partition emptyPartition;
    const std::vector<double> *attribute;
    const Partition *partition;
    bool nominal; // whether we calculate assortativity for a nominal or ordinal attribute
    double coefficient;
};

} /* namespace NetworKit */
#endif // NETWORKIT_CORRELATION_ASSORTATIVITY_HPP_