dbscan
DBSCAN implementation (forked from shiguodong/dbscan)
$ gem install dbscan
$ ruby examples/simple.rb
Example:
input = [ 0, 10, 20 ],
[ 0, 11, 21 ],
[ 0, 12, 20 ],
[ 20, 33, 59 ],
[ 21, 32, 56 ],
[ 59, 77, 101 ],
[ 58, 79, 100 ],
[ 58, 76, 102 ],
[ 300, 70, 20 ],
[ 500, 300, 202],
[ 500, 302, 204 ]
Output:
{-1=>[[300, 70, 20]],
0=>[[0, 10, 20], [0, 11, 21], [0, 12, 20]],
1=>[[20, 33, 59], [21, 32, 56]],
2=>[[59, 77, 101], [58, 79, 100], [58, 76, 102]],
3=>[[500, 300, 202], [500, 302, 204]]}