{"id":19267088,"url":"https://github.com/mljs/simple-clustering","last_synced_at":"2025-04-21T19:32:36.864Z","repository":{"id":57299005,"uuid":"65207000","full_name":"mljs/simple-clustering","owner":"mljs","description":"Extracts the isolated sub-blocs of a binary matrix","archived":false,"fork":false,"pushed_at":"2020-10-09T12:49:53.000Z","size":77,"stargazers_count":0,"open_issues_count":4,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T06:05:47.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mljs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-08T13:37:13.000Z","updated_at":"2020-10-09T12:49:55.000Z","dependencies_parsed_at":"2022-08-26T18:12:42.654Z","dependency_job_id":null,"html_url":"https://github.com/mljs/simple-clustering","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fsimple-clustering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fsimple-clustering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fsimple-clustering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fsimple-clustering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljs","download_url":"https://codeload.github.com/mljs/simple-clustering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250120090,"owners_count":21378135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T20:10:09.028Z","updated_at":"2025-04-21T19:32:36.858Z","avatar_url":"https://github.com/mljs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-clustering\n\nFinds the isolated clusters from a similarity/connectivity matrix.\n\nThe input could be a matrix (array of arrays) or it could be a single array containing the values of the upper triangular of that matrix.\n\nBy default the function returns a clustering matrix: It is a binary row wise matrix, where each row has n components. The ones at row i and column j indicates that element j belong to cluster i.\n\n## Installation\n\n`$ npm install ml-simple-clustering`\n\n## Usage\n### As an ES module\n\n```js\nimport { simpleClustering } from 'ml-simple-clustering';\n\nconst clusters = simpleClustering(dataMatrix, options);\n```\n\n### As a CommonJS module\n\n```js\nconst { simpleClustering } = require('ml-simple-clustering');\n\nconst clusters = simpleClustering(dataMatrix, options);\n```\n## [API Documentation](https://mljs.github.io/simpleClustering/docs/globals.html)\nIn order to get a general idea of the problem you could also check the [Wikipedia article](https://en.wikipedia.org/wiki/Flood_fill).\n## Examples\n\n```js\nconst { simpleClustering } = require('ml-simple-clustering');\n\nlet matrix = [\n  [1, 2, 0, 0],\n  [1, 2, 0, 0],\n  [0, 0, 3, 4],\n  [0, 0, 5, 6],\n];\n\nlet clusters = simpleClustering(matrix, {\n  threshold: 0,\n  out: 'values',\n});\nconsole.log(`clusters = ${clusters}`);\n/**\n clusters = [\n  [\n    [1, 2],\n    [1, 2],\n  ],\n  [\n    [3, 4],\n    [5, 6],\n  ],\n]\n  */\n```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fsimple-clustering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljs%2Fsimple-clustering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fsimple-clustering/lists"}