1#ifndef SCRAN_GRAPH_CLUSTER_CLUSTER_LEIDEN_HPP
2#define SCRAN_GRAPH_CLUSTER_CLUSTER_LEIDEN_HPP
7#include "raiigraph/raiigraph.hpp"
8#include "sanisizer/sanisizer.hpp"
98 const auto membership = output.
membership.get();
99 const auto quality = (options.
report_quality ? &(output.
quality) :
static_cast<igraph_real_t*
>(NULL));
101 const raiigraph::RNGScope rngs(options.
seed);
104 output.
status = igraph_community_leiden(
119 auto strengths = sanisizer::create<raiigraph::RealVector>(igraph_vcount(graph));
120 igraph_strength(graph, strengths, igraph_vss_all(), IGRAPH_ALL, 1, weights);
122 const double total_weights = igraph_vector_sum(strengths);
123 const double mod_resolution = options.
resolution / total_weights;
125 output.
status = igraph_community_leiden(
153 igraph_vector_t weight_view;
154 igraph_vector_view(&weight_view, weights.data(), sanisizer::cast<igraph_integer_t>(weights.size()));
Graph-based clustering of single-cell data.
Definition build_snn_graph.hpp:22
void cluster_leiden(const igraph_t *graph, const igraph_vector_t *weights, const ClusterLeidenOptions &options, ClusterLeidenResults &output)
Definition cluster_leiden.hpp:97
Options for cluster_leiden().
Definition cluster_leiden.hpp:22
int seed
Definition cluster_leiden.hpp:59
bool modularity
Definition cluster_leiden.hpp:49
double beta
Definition cluster_leiden.hpp:34
double resolution
Definition cluster_leiden.hpp:28
bool report_quality
Definition cluster_leiden.hpp:54
int iterations
Definition cluster_leiden.hpp:41
Result of cluster_leiden().
Definition cluster_leiden.hpp:65
int status
Definition cluster_leiden.hpp:70
igraph_real_t quality
Definition cluster_leiden.hpp:81
raiigraph::IntegerVector membership
Definition cluster_leiden.hpp:75