Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hcluster.js

Agglomerative Hierarchical Clustering in JavaScript. (that plays nice with d3.js).

Demo + Blog Post

by @ChrisPolis

Usage

var colorCluster = hcluster()
  .distance('euclidean') // support for 'euclidean' and 'angular'
  .linkage('avg')        // support for 'avg', 'max' and 'min'
  .verbose(true)         // false by default
  .posKey('rgbValue')    // 'position' by default

  // pass in an array of objects w/ array values for 'position' or specified posKey()
  .data(colors);         // as an array of objects w/ array values for 'position'

// integrate into d3 layout.cluster
var cluster = d3.layout.cluster().size([200, 200]),
    nodes = cluster.nodes(colorCluster.tree()),
    links = cluster.links(nodes);

// get the tree, cut incertain ways
colorCluster.orderedNodes();  // returns array of leaves, ordered by tree structure
colorCluster.getClusters(k); // return k(2 to n) clusters of leaves

License

MIT

About

Agglomerative Hierarchical Clustering in JavaScript. (that plays nice with d3.js).

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages