↰ Return to documentation for file (include/networkit/centrality/ComplexPaths.hpp
)
/*
* ComplexPaths.hpp
*
*
* Created on:16.06.2023
* Author: Klaus Ahrens
* <ahrens@informatik.hu-berlin.de>
*
* adapted and reimplemented from
*
* https://github.com/drguilbe/complexpaths.git
*
* see [ Guilbeault, D., Centola, D. Topological measures for
* identifying and predicting the spread of complex contagions.
* Nat Commun 12, 4430 (2021).
* https://doi.org/10.1038/s41467-021-24704-6 ]
*
*/
#ifndef NETWORKIT_CENTRALITY_COMPLEX_PATHS_HPP_
#define NETWORKIT_CENTRALITY_COMPLEX_PATHS_HPP_
#include <random>
#include <vector>
#include <networkit/base/Algorithm.hpp>
#include <networkit/graph/Graph.hpp>
namespace NetworKit {
class ComplexPathAlgorithm : public Algorithm {
public:
enum Mode { singleNode, allNodes };
ComplexPathAlgorithm(const Graph &G, count threshold = 3, Mode mode = Mode::allNodes,
node start = none);
void normalize();
void run() override;
std::vector<double> getPLci();
Graph getComplexGraph();
std::vector<node> getAdopters();
private:
const Graph *inputGraph;
Graph complexPathGraph;
std::vector<double> complexPathsLengths;
std::vector<node> adopters;
const Mode mode;
const node start;
const count threshold;
bool normPaths;
Graph complexPathsGraph(node seed, count threshold, std::vector<node> *adopters);
std::vector<double> complexPathLength(count t);
std::vector<node> generateSeeds(node seed, const Graph &g, count threshold);
};
} /* namespace NetworKit */
#endif // NETWORKIT_CENTRALITY_COMPLEX_PATHS_HPP_