scran_graph_cluster
Graph-based clustering of cells
Loading...
Searching...
No Matches
cluster_multilevel.hpp
Go to the documentation of this file.
1#ifndef SCRAN_CLUSTER_MULTILEVEL_HPP
2#define SCRAN_CLUSTER_MULTILEVEL_HPP
3
4#include <vector>
5#include <algorithm>
6
7#include "raiigraph/raiigraph.hpp"
8#include "igraph.h"
9
15namespace scran_graph_cluster {
16
25 double resolution = 1;
26
30 int seed = 42;
31
35 bool report_levels = true;
36
40 bool report_modularity = true;
41};
42
51 int status = 0;
52
57 raiigraph::IntegerVector membership;
58
64 raiigraph::IntegerMatrix levels;
65
71 raiigraph::RealVector modularity;
72};
73
86 raiigraph::RNGScope rngs(options.seed);
87
88 auto modularity = (options.report_modularity ? output.modularity.get() : NULL);
89 auto membership = output.membership.get();
90 auto memberships = (options.report_levels ? output.levels.get() : NULL);
91
93 graph,
94 weights,
95 options.resolution,
96 membership,
98 modularity
99 );
100}
101
112inline ClusterMultilevelResults cluster_multilevel(const raiigraph::Graph& graph, const std::vector<igraph_real_t>& weights, const ClusterMultilevelOptions& options) {
113 // No need to free this, as it's just a view.
115 igraph_vector_view(&weight_view, weights.data(), weights.size());
116
119 return output;
120}
121
122}
123
124#endif
Graph-based clustering of single-cell data.
Definition build_snn_graph.hpp:20
void cluster_multilevel(const igraph_t *graph, const igraph_vector_t *weights, const ClusterMultilevelOptions &options, ClusterMultilevelResults &output)
Definition cluster_multilevel.hpp:85
void build_snn_graph(size_t num_cells, GetNeighbors_ get_neighbors, GetIndex_ get_index, const BuildSnnGraphOptions &options, BuildSnnGraphResults< Node_, Weight_ > &output)
Definition build_snn_graph.hpp:133
Options for cluster_multilevel().
Definition cluster_multilevel.hpp:20
bool report_modularity
Definition cluster_multilevel.hpp:40
int seed
Definition cluster_multilevel.hpp:30
bool report_levels
Definition cluster_multilevel.hpp:35
double resolution
Definition cluster_multilevel.hpp:25
Result of cluster_multilevel().
Definition cluster_multilevel.hpp:46
int status
Definition cluster_multilevel.hpp:51
raiigraph::RealVector modularity
Definition cluster_multilevel.hpp:71
raiigraph::IntegerVector membership
Definition cluster_multilevel.hpp:57
raiigraph::IntegerMatrix levels
Definition cluster_multilevel.hpp:64