{"id":20020297,"url":"https://github.com/multivacplatform/louvain","last_synced_at":"2025-05-05T00:33:09.581Z","repository":{"id":91344946,"uuid":"112255006","full_name":"multivacplatform/louvain","owner":"multivacplatform","description":"Louvain community detection","archived":false,"fork":false,"pushed_at":"2018-11-25T20:55:35.000Z","size":75,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T07:49:44.135Z","etag":null,"topics":["algorithm","community-detection","graph","louvain","louvain-community-detection"],"latest_commit_sha":null,"homepage":"https://multivac.iscpif.fr","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multivacplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-27T22:16:49.000Z","updated_at":"2024-09-05T10:02:30.000Z","dependencies_parsed_at":"2023-07-02T13:00:15.512Z","dependency_job_id":null,"html_url":"https://github.com/multivacplatform/louvain","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"2b281530f9a77759106199579b8dc153e24b1953"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Flouvain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Flouvain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Flouvain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Flouvain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multivacplatform","download_url":"https://codeload.github.com/multivacplatform/louvain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252420898,"owners_count":21745143,"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":["algorithm","community-detection","graph","louvain","louvain-community-detection"],"created_at":"2024-11-13T08:31:13.375Z","updated_at":"2025-05-05T00:33:04.558Z","avatar_url":"https://github.com/multivacplatform.png","language":"JavaScript","readme":"# Louvain [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/multivacplatform/louvain/blob/master/LICENSE)\n\n\n---\n## Description\n\nFormally, a community detection aims to partition a graph’s vertices in subsets, such that there are many edges connecting between vertices of the same sub-set compared to vertices of different sub-sets; in essence, a community has many more ties between each constituent part than with outsiders. There are numerous algorithms present in the literature for solving this problem, a complete survey can be found in [1].  \n\nOne of the popular community detection algorithms is presented in [2]. This algorithm separates the network in communities by optimizing greedily a modularity score after trying various grouping operations on the network. By using this simple greedy approach the algorithm is computationally very efficient.\n\n[1] Fortunato, Santo. \"Community detection in graphs.\" Physics Reports 486, no. 3-5 (2010).\n\n\n[2] V.D. Blondel, J.-L. Guillaume, R. Lambiotte, E. Lefebvre. \"Fast unfolding of communities in large networks.\" J. Stat. Mech., 2008: 1008.\n\n(http://arxiv.org/abs/0803.0476) (http://en.wikipedia.org/wiki/Community_structure#The_Louvain_method).\n\n## Usage\n0. Install the package from NPM\n```shell\nnpm i --save louvain\n```\n1. Import the package.\n```javascript\nlet louvain = require('louvain');\n```\n\t\t\n\t\t\n2. Sample Data Format\n#### Node Data\n```javascript\nlet node_data = ['id1', 'id2', 'id3']; // any type of string can be used as id\n```\n#### Edge Data\n```javascript\nlet edge_data = [\n\t{source: 'id1', target:'id2', weight: 10.0},\n\t{source: 'id2', target:'id3', weight: 20.0}, \n\t{source: 'id3', target:'id1', weight: 30.0}\n];\n```\n#### (Optional) Partition Data\n```javascript\nlet init_part = {'id1':0, 'id2':0, 'id3': 1}; \n// Object with ids of nodes as properties and community number assigned as value.\n```\n3. Run the Algorithm on your node and edge set by chaining the **nodes** and **edges** methods, optionally you can provide an intermediary community partition assignement with the **partition_init** method. [ **Order of chaining is important** ]\n```javascript\n\t\nlet community = louvain().nodes(node_data).edges(edge_data).partition_init(init_part);\nlet result  = community();\n\n```\n![](example/default.png)\n\n#### After Community Detection\n\nWe can see the partitioned graph vertices with the help of color coding.\n\n![](example/communities.png)\n\n## Test\nThis has been tested with Node.js v6.11.5 / npm 5.5.1 - written in ES6\n\n## Code of Conduct\n\nThis, and all github.com/multivacplatform projects, are under the [Multivac Platform Open Source Code of Conduct](https://github.com/multivacplatform/code-of-conduct/blob/master/code-of-conduct.md). Additionally, see the [Typelevel Code of Conduct](http://typelevel.org/conduct) for specific examples of harassing behavior that are not tolerated.\n\n\n## Credit\nCorneliu S. (jLouvain) [https://github.com/upphiminn/jLouvain]\n\n## License\nThe MIT License (MIT)\n\n","funding_links":[],"categories":["Cyclic Patterns"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultivacplatform%2Flouvain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultivacplatform%2Flouvain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultivacplatform%2Flouvain/lists"}