#ifndef NK_CENTRALITY_H #define NK_CENTRALITY_H #include "rust/cxx.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "graph_event.h" namespace NetworKit { using namespace std; inline unique_ptr NewApproxBetweenness( const Graph &G, double epsilon = 0.01, double delta = 0.1, double universalConstant = 1.0) { return make_unique(G, epsilon, delta, universalConstant); } inline void ApproxBetweennessRanking(ApproxBetweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> ApproxBetweennessScores(ApproxBetweenness &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewApproxCloseness( const Graph &G, count nSamples, double epsilon, bool normalized, uint8_t t) { ApproxCloseness::ClosenessType type; switch (t) { case 0: type = ApproxCloseness::ClosenessType::OUTBOUND; break; case 1: type = ApproxCloseness::ClosenessType::INBOUND; break; case 2: type = ApproxCloseness::ClosenessType::SUM; break; default: type = ApproxCloseness::ClosenessType::OUTBOUND; } return make_unique(G, nSamples, epsilon, normalized, type); } inline void ApproxClosenessRanking(ApproxCloseness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> ApproxClosenessScores(ApproxCloseness &algo) { return make_unique>(algo.scores()); } inline unique_ptr> ApproxClosenessGetSquareErrorEstimates(ApproxCloseness &algo) { return make_unique>(algo.getSquareErrorEstimates()); } inline unique_ptr NewApproxElectricalCloseness( const Graph &G, double epsilon = 0.1, double kappa = 0.3) { return make_unique(G, epsilon, kappa); } inline void ApproxElectricalClosenessRanking(ApproxElectricalCloseness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> ApproxElectricalClosenessScores(ApproxElectricalCloseness &algo) { return make_unique>(algo.scores()); } inline unique_ptr> ApproxElectricalClosenessComputeExactDiagonal(const ApproxElectricalCloseness &algo, double tol) { return make_unique>(algo.computeExactDiagonal(tol)); } inline unique_ptr> ApproxElectricalClosenessGetDiagonal(const ApproxElectricalCloseness &algo) { return make_unique>(algo.getDiagonal()); } inline unique_ptr NewApproxGroupBetweenness( const Graph &G, count groupSize, double epsilon) { return make_unique(G, groupSize, epsilon); } inline unique_ptr> ApproxGroupBetweennessGroupMaxBetweenness(const ApproxGroupBetweenness &algo) { return make_unique>(algo.groupMaxBetweenness()); } inline unique_ptr> ApproxGroupBetweennessScoreOfGroup(const ApproxGroupBetweenness &algo, rust::Slice S, bool normalized) { vector nodes(S.begin(), S.end()); return make_unique>(algo.scoreOfGroup(nodes, normalized)); } inline unique_ptr NewApproxSpanningEdge( const Graph &G, double epsilon) { return make_unique(G, epsilon); } inline unique_ptr> ApproxSpanningEdgeScores(const ApproxSpanningEdge &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewBetweenness( const Graph &G, bool normalized = false, bool computeEdgeCentrality = false) { return make_unique(G, normalized, computeEdgeCentrality); } inline void BetweennessRanking(Betweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> BetweennessScores(Betweenness &algo) { return make_unique>(algo.scores()); } inline unique_ptr> BetweennessEdgeScores(Betweenness &algo) { return make_unique>(algo.edgeScores()); } inline unique_ptr NewCloseness( const Graph &G, bool normalized, uint8_t variant) { return make_unique(G, normalized, variant); } inline void ClosenessRanking(Closeness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> ClosenessScores(Closeness &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewCoreDecomposition( const Graph &G, bool normalized = false, bool enforceBucketQueueAlgorithm = false, bool storeNodeOrder = false) { return make_unique(G, normalized, enforceBucketQueueAlgorithm, storeNodeOrder); } inline void CoreDecompositionRanking(CoreDecomposition &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> CoreDecompositionScores(CoreDecomposition &algo) { return make_unique>(algo.scores()); } inline unique_ptr CoreDecompositionGetCover(const CoreDecomposition &algo) { return make_unique(algo.getCover()); } inline unique_ptr> CoreDecompositionGetNodeOrder(const CoreDecomposition &algo) { return make_unique>(algo.getNodeOrder()); } inline unique_ptr CoreDecompositionGetPartition(const CoreDecomposition &algo) { return make_unique(algo.getPartition()); } inline unique_ptr NewDegreeCentrality( const Graph &G, bool normalized = false, bool outDeg = false, bool ignoreSelfLoops = false) { return make_unique(G, normalized, outDeg, ignoreSelfLoops); } inline void DegreeCentralityRanking(DegreeCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> DegreeCentralityScores(DegreeCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewDynApproxBetweenness( const Graph &G, double epsilon = 0.01, double delta = 0.1, bool storePredecessors = true, double universalConstant = 0.5) { return make_unique(G, epsilon, delta, storePredecessors, universalConstant); } inline void DynApproxBetweennessRanking(DynApproxBetweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> DynApproxBetweennessScores(DynApproxBetweenness &algo) { return make_unique>(algo.scores()); } inline void DynApproxBetweennessUpdate(DynApproxBetweenness &algo, uint8_t kind, node u, node v, edgeweight ew) { algo.update(toGraphEvent(kind, u, v, ew)); } inline void DynApproxBetweennessUpdateBatch(DynApproxBetweenness &algo, rust::Slice kinds, rust::Slice us, rust::Slice vs, rust::Slice ews) { vector evs; evs.reserve(kinds.length()); for (size_t i = 0; i < kinds.length(); ++i) { evs.emplace_back(toGraphEvent(kinds[i], us[i], vs[i], ews[i])); } algo.updateBatch(evs); } inline unique_ptr NewDynBetweenness( const Graph &G) { return make_unique(G); } inline void DynBetweennessRanking(DynBetweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> DynBetweennessScores(DynBetweenness &algo) { return make_unique>(algo.scores()); } inline void DynBetweennessUpdate(DynBetweenness &algo, uint8_t kind, node u, node v, edgeweight ew) { algo.update(toGraphEvent(kind, u, v, ew)); } inline void DynBetweennessUpdateBatch(DynBetweenness &algo, rust::Slice kinds, rust::Slice us, rust::Slice vs, rust::Slice ews) { vector evs; evs.reserve(kinds.length()); for (size_t i = 0; i < kinds.length(); ++i) { evs.emplace_back(toGraphEvent(kinds[i], us[i], vs[i], ews[i])); } algo.updateBatch(evs); } inline unique_ptr NewDynBetweennessOneNode( Graph &G, node x) { return make_unique(G, x); } inline void DynBetweennessOneNodeUpdate(DynBetweennessOneNode &algo, uint8_t kind, node u, node v, edgeweight ew) { algo.update(toGraphEvent(kind, u, v, ew)); } inline edgeweight DynBetweennessOneNodeComputeScore(DynBetweennessOneNode &algo, uint8_t kind, node u, node v, edgeweight ew) { return algo.computeScore(toGraphEvent(kind, u, v, ew)); } inline void DynBetweennessOneNodeUpdateBatch(DynBetweennessOneNode &algo, rust::Slice kinds, rust::Slice us, rust::Slice vs, rust::Slice ews) { vector evs; evs.reserve(kinds.length()); for (size_t i = 0; i < kinds.length(); ++i) { evs.emplace_back(toGraphEvent(kinds[i], us[i], vs[i], ews[i])); } algo.updateBatch(evs); } inline unique_ptr NewDynKatzCentrality( const Graph &G, count k, bool groupOnly = false, double tolerance = 1e-9) { return make_unique(G, k, groupOnly, tolerance); } inline void DynKatzCentralityRanking(DynKatzCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> DynKatzCentralityScores(DynKatzCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr> DynKatzCentralityTop(DynKatzCentrality &algo, count n) { return make_unique>(algo.top(n)); } inline void DynKatzCentralityUpdate(DynKatzCentrality &algo, uint8_t kind, node u, node v, edgeweight ew) { algo.update(toGraphEvent(kind, u, v, ew)); } inline void DynKatzCentralityUpdateBatch(DynKatzCentrality &algo, rust::Slice kinds, rust::Slice us, rust::Slice vs, rust::Slice ews) { vector evs; evs.reserve(kinds.length()); for (size_t i = 0; i < kinds.length(); ++i) { evs.emplace_back(toGraphEvent(kinds[i], us[i], vs[i], ews[i])); } algo.updateBatch(evs); } inline unique_ptr NewDynTopHarmonicCloseness( const Graph &G, count k = 1, bool useBFSbound = false) { return make_unique(G, k, useBFSbound); } inline void DynTopHarmonicClosenessRanking(DynTopHarmonicCloseness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline void DynTopHarmonicClosenessUpdate(DynTopHarmonicCloseness &algo, uint8_t kind, node u, node v, edgeweight ew) { algo.update(toGraphEvent(kind, u, v, ew)); } inline void DynTopHarmonicClosenessUpdateBatch(DynTopHarmonicCloseness &algo, rust::Slice kinds, rust::Slice us, rust::Slice vs, rust::Slice ews) { vector evs; evs.reserve(kinds.length()); for (size_t i = 0; i < kinds.length(); ++i) { evs.emplace_back(toGraphEvent(kinds[i], us[i], vs[i], ews[i])); } algo.updateBatch(evs); } inline unique_ptr> DynTopHarmonicClosenessTopkNodesList(DynTopHarmonicCloseness &algo, bool includeTrail) { return make_unique>(algo.topkNodesList(includeTrail)); } inline unique_ptr> DynTopHarmonicClosenessTopkScoresList(DynTopHarmonicCloseness &algo, bool includeTrail) { return make_unique>(algo.topkScoresList(includeTrail)); } inline unique_ptr NewEigenvectorCentrality( const Graph &G, double tol) { return make_unique(G, tol); } inline void EigenvectorCentralityRanking(EigenvectorCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> EigenvectorCentralityScores(EigenvectorCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewEstimateBetweenness( const Graph &G, count nSamples, bool normalized = false, bool parallel_flag = false) { return make_unique(G, nSamples, normalized, parallel_flag); } inline void EstimateBetweennessRanking(EstimateBetweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> EstimateBetweennessScores(EstimateBetweenness &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewForestCentrality( const Graph &G, node root, double epsilon = 0.1, double kappa = 0.3) { return make_unique(G, root, epsilon, kappa); } inline void ForestCentralityRanking(ForestCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> ForestCentralityScores(ForestCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr> ForestCentralityGetDiagonal(const ForestCentrality &algo) { return make_unique>(algo.getDiagonal()); } inline unique_ptr NewGedWalk( const Graph &G, count k, double initEpsilon, double alpha, uint8_t bs, uint8_t gs, double spectralDelta) { GedWalk::BoundStrategy bs_; switch (bs) { case 0: bs_ = GedWalk::BoundStrategy::NO; break; case 1: bs_ = GedWalk::BoundStrategy::SPECTRAL; break; case 2: bs_ = GedWalk::BoundStrategy::GEOMETRIC; break; case 3: bs_ = GedWalk::BoundStrategy::ADAPTIVE_GEOMETRIC; break; default: break; } GedWalk::GreedyStrategy gs_; switch (gs) { case 0: gs_ = GedWalk::GreedyStrategy::LAZY; break; case 1: gs_ = GedWalk::GreedyStrategy::STOCHASTIC; break; default: break; } return make_unique(G, k, initEpsilon, alpha, bs_, gs_, spectralDelta); } inline unique_ptr> GedWalkGroupMaxGedWalk(const GedWalk &algo) { return make_unique>(algo.groupMaxGedWalk()); } inline double GedWalkScoreOfGroup(GedWalk &algo, rust::Slice group, double epsilon) { return algo.scoreOfGroup(group.begin(), group.end(), epsilon); } inline unique_ptr NewGroupCloseness( const Graph &G, count k, count H) { return make_unique(G, k, H); } inline double GroupClosenessScoreOfGroup(GroupCloseness &algo, rust::Slice group) { vector gp{group.begin(), group.end()}; return algo.scoreOfGroup(gp); } inline unique_ptr> GroupClosenessGroupMaxCloseness(GroupCloseness &algo) { return make_unique>(algo.groupMaxCloseness()); } inline double GroupClosenessComputeFarness(const GroupCloseness &algo, rust::Slice group, count H) { vector gp{group.begin(), group.end()}; return algo.computeFarness(gp, H); } inline unique_ptr NewGroupClosenessGrowShrink( const Graph &graph, rust::Slice group, bool extended = false, count insertions = 0, count maxIterations = 100) { return make_unique(graph, group.begin(), group.end(), extended, insertions, maxIterations); } inline unique_ptr> GroupClosenessGrowShrinkGroupMaxCloseness(const GroupClosenessGrowShrink &algo) { return make_unique>(algo.groupMaxCloseness()); } inline unique_ptr NewGroupClosenessLocalSearch( const Graph &graph, rust::Slice group, bool runGrowShrink = true, count maxIterations = 100) { return make_unique(graph, group.begin(), group.end(), runGrowShrink, maxIterations); } inline unique_ptr> GroupClosenessLocalSearchGroupMaxCloseness(const GroupClosenessLocalSearch &algo) { return make_unique>(algo.groupMaxCloseness()); } inline unique_ptr NewGroupClosenessLocalSwaps( const Graph &graph, rust::Slice group, count maxSwaps) { return make_unique(graph, group.begin(), group.end(), maxSwaps); } inline unique_ptr> GroupClosenessLocalSwapsGroupMaxCloseness(const GroupClosenessLocalSwaps &algo) { return make_unique>(algo.groupMaxCloseness()); } inline unique_ptr NewGroupDegree( const Graph &graph, count k = 1, bool countGroupNodes = true) { return make_unique(graph, k, countGroupNodes); } inline unique_ptr> GroupDegreeGroupMaxDegree(GroupDegree &algo) { return make_unique>(algo.groupMaxDegree()); } inline double GroupDegreeScoreOfGroup(const GroupDegree &algo, rust::Slice group) { vector gp{group.begin(), group.end()}; return algo.scoreOfGroup(gp); } inline unique_ptr NewGroupHarmonicCloseness( const Graph &G, count k) { return make_unique(G, k); } inline double GroupHarmonicClosenessScoreOfGroup(const Graph &graph, rust::Slice group) { return GroupHarmonicCloseness::scoreOfGroup(graph, group.begin(), group.end()); } inline unique_ptr> GroupHarmonicClosenessGroupMaxHarmonicCloseness(GroupHarmonicCloseness &algo) { return make_unique>(algo.groupMaxHarmonicCloseness()); } inline unique_ptr NewHarmonicCloseness( const Graph &G, bool normalized) { return make_unique(G, normalized); } inline void HarmonicClosenessRanking(HarmonicCloseness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> HarmonicClosenessScores(HarmonicCloseness &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewKPathCentrality( const Graph &G, double alpha = 0.2, count k = 0) { return make_unique(G, alpha, k); } inline void KPathCentralityRanking(KPathCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> KPathCentralityScores(KPathCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewKadabraBetweenness( const Graph &G, double err = 0.01, double delta = 0.1, bool deterministic = false, count k = 0, count unionSample = 0, count startFactor = 100) { return make_unique(G, err, delta, deterministic, k, unionSample, startFactor); } inline void KadabraBetweennessRanking(KadabraBetweenness &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> KadabraBetweennessScores(KadabraBetweenness &algo) { return make_unique>(algo.scores()); } inline unique_ptr> KadabraBetweennessTopkNodesList(KadabraBetweenness &algo) { return make_unique>(algo.topkNodesList()); } inline unique_ptr> KadabraBetweennessTopkScoresList(KadabraBetweenness &algo) { return make_unique>(algo.topkScoresList()); } inline unique_ptr NewKatzCentrality( const Graph &G, double alpha = 0, double beta = 0.1, double tol = 1e-8) { return make_unique(G, alpha, beta, tol); } inline void KatzCentralityRanking(KatzCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> KatzCentralityScores(KatzCentrality &algo) { return make_unique>(algo.scores()); } inline void KatzCentralitySetEdgeDirection(KatzCentrality &algo, bool isOut) { if (isOut) { algo.edgeDirection = EdgeDirection::OUT_EDGES; } else { algo.edgeDirection = EdgeDirection::IN_EDGES; } } inline unique_ptr NewLaplacianCentrality( const Graph &G, bool normalized) { return make_unique(G, normalized); } inline void LaplacianCentralityRanking(LaplacianCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> LaplacianCentralityScores(LaplacianCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewLocalClusteringCoefficient( const Graph &G, bool turbo) { return make_unique(G, turbo); } inline void LocalClusteringCoefficientRanking(LocalClusteringCoefficient &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> LocalClusteringCoefficientScores(LocalClusteringCoefficient &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewLocalPartitionCoverage( const Graph &G, const Partition &p) { return make_unique(G, p); } inline void LocalPartitionCoverageRanking(LocalPartitionCoverage &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> LocalPartitionCoverageScores(LocalPartitionCoverage &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewLocalSquareClusteringCoefficient( const Graph &G) { return make_unique(G); } inline void LocalSquareClusteringCoefficientRanking(LocalSquareClusteringCoefficient &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> LocalSquareClusteringCoefficientScores(LocalSquareClusteringCoefficient &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewPageRank( const Graph &G, double damp = 0.85, double tol = 1e-8, bool normalized = false, bool distribute_sinks = false) { PageRank::SinkHandling sh; if (distribute_sinks) { sh = PageRank::SinkHandling::NO_SINK_HANDLING; } else { sh = PageRank::SinkHandling::DISTRIBUTE_SINKS; } return make_unique(G, damp, tol, normalized, sh); } inline void PageRankRanking(PageRank &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> PageRankScores(PageRank &algo) { return make_unique>(algo.scores()); } inline void PageRankSetMaxIterations(PageRank &algo, count limit) { algo.maxIterations = limit; } inline void PageRankSetNorm(PageRank &algo, uint8_t n) { PageRank::Norm norm; switch (n) { case 0: norm = PageRank::Norm::L1_NORM; break; case 1: norm = PageRank::Norm::L2_NORM; break; default: norm = PageRank::Norm::L2_NORM; break; } algo.norm = norm; } inline unique_ptr NewPermanenceCentrality(const Graph &G, const Partition &P) { return make_unique(G, P); } inline unique_ptr NewSfigality( const Graph &G) { return make_unique(G); } inline void SfigalityRanking(Sfigality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> SfigalityScores(Sfigality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewSpanningEdgeCentrality( const Graph &G, double tol) { return make_unique(G, tol); } inline void SpanningEdgeCentralityRanking(SpanningEdgeCentrality &algo, rust::Vec &ks, rust::Vec &vs) { for (auto &&pair : algo.ranking()) { ks.push_back(pair.first); vs.push_back(pair.second); } } inline unique_ptr> SpanningEdgeCentralityScores(SpanningEdgeCentrality &algo) { return make_unique>(algo.scores()); } inline unique_ptr NewTopCloseness( const Graph &G, count k = 1, bool first_heu = true, bool sec_heu = true) { return make_unique(G, k, first_heu, sec_heu); } inline unique_ptr> TopClosenessTopkNodesList(TopCloseness &algo, bool includeTrail) { return make_unique>(algo.topkNodesList(includeTrail)); } inline unique_ptr> TopClosenessTopkScoresList(TopCloseness &algo, bool includeTrail) { return make_unique>(algo.topkScoresList(includeTrail)); } inline void TopClosenessRestrictTopKComputationToNodes(TopCloseness &algo, rust::Slice nodes) { vector ns{nodes.begin(), nodes.end()}; algo.restrictTopKComputationToNodes(ns); } inline unique_ptr NewTopHarmonicCloseness( const Graph &G, count k = 1, bool useNBbound = false) { return make_unique(G, k, useNBbound); } inline unique_ptr> TopHarmonicClosenessTopkNodesList(TopHarmonicCloseness &algo, bool includeTrail) { return make_unique>(algo.topkNodesList(includeTrail)); } inline unique_ptr> TopHarmonicClosenessTopkScoresList(TopHarmonicCloseness &algo, bool includeTrail) { return make_unique>(algo.topkScoresList(includeTrail)); } inline void TopHarmonicClosenessRestrictTopKComputationToNodes(TopHarmonicCloseness &algo, rust::Slice nodes) { vector ns{nodes.begin(), nodes.end()}; algo.restrictTopKComputationToNodes(ns); } } #endif // NK_CENTRALITY_H