Skip to content

Instantly share code, notes, and snippets.

@davetapley
Last active August 29, 2015 14:02
Show Gist options
  • Save davetapley/fee680610f058fcfc579 to your computer and use it in GitHub Desktop.
Save davetapley/fee680610f058fcfc579 to your computer and use it in GitHub Desktop.
Clustering
Start with a list of clusters:
a, b, x, c, x, x, d, e, f, g, x, h
Select out clusters to try and find a place for:
a, b, c, d, e, f, g, h
Map over a method to (optionally) assign a place (pN) to each cluster:
(this is done with a DelegateClass containing the place or nil)
a(p1), b(p2), c(nil), d(p1), e(p1), f(nil), g(p1), h(p1)
Merge together clusters with the same place, who were originally adjacent:
a(p1), b(p2), c(nil), de(p1), f(nil), g(p1), h(p1)
d and e are merged, because they're at the same place;
g and h aren't, because there was originally an x cluster between them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment