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
87 raiigraph::RNGScope rngs(options.seed);
88
89 auto modularity = (options.report_modularity ? output.modularity.get() : NULL);
90 auto membership = output.membership.get();
91 auto memberships = (options.report_levels ? output.levels.get() : NULL);
92
94 graph,
95 weights,
96 options.resolution,
97 membership,
99 modularity
100 );
101}
102
113inline ClusterMultilevelResults cluster_multilevel(const raiigraph::Graph& graph, const std::vector<igraph_real_t>& weights, const ClusterMultilevelOptions& options) {
114 // No need to free this, as it's just a view.
116 igraph_vector_view(&weight_view, weights.data(), weights.size());
117
120 return output;
121}
122
123}
124
125#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:86
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