Closed CorradoLanera closed 5 years ago
partition_
and they are:
nrow
[640ms], caused by lazyloadDBfetch
(~ number of rows) --- I don't know
how to improve this (if it is possible)grouping_part
[860ms], mainly caused by the resizing of two vectors
in the main list --- I'll think about how to improve this one. Anyway, given the number
of groups (g) and the number of clusters (k) the complexity is:
I wonder if a simpler approach would to be simply iterate over n, at each point assigning to the cluster with the fewest current groups.
I'm going to use a completely new strategy - thanks for trying!
The function proposed
works recursively and it should beis able to manage explicit index for the nodes (maybe for future). Simple balancing was expected.I've set up some testthat()s which failed with the previous formula/procedure and correctly pass with the proposed one.