{"id":13907550,"url":"https://github.com/upphiminn/jLouvain","last_synced_at":"2025-07-18T05:32:48.441Z","repository":{"id":10431459,"uuid":"12594842","full_name":"upphiminn/jLouvain","owner":"upphiminn","description":"Louvain community detection for Javascript (http://arxiv.org/abs/0803.0476) (http://en.wikipedia.org/wiki/Community_structure#The_Louvain_method).","archived":false,"fork":false,"pushed_at":"2021-07-29T20:08:12.000Z","size":105,"stargazers_count":146,"open_issues_count":9,"forks_count":51,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-03-27T10:21:47.833Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/upphiminn.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}},"created_at":"2013-09-04T15:40:59.000Z","updated_at":"2024-02-22T11:41:14.000Z","dependencies_parsed_at":"2022-08-30T18:02:07.662Z","dependency_job_id":null,"html_url":"https://github.com/upphiminn/jLouvain","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/upphiminn%2FjLouvain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upphiminn%2FjLouvain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upphiminn%2FjLouvain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upphiminn%2FjLouvain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upphiminn","download_url":"https://codeload.github.com/upphiminn/jLouvain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226210053,"owners_count":17590496,"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-08-06T23:01:59.202Z","updated_at":"2024-11-25T16:30:37.178Z","avatar_url":"https://github.com/upphiminn.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Software","Cyclic Patterns"],"sub_categories":["JavaScript"],"readme":"# jLouvain\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[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## Usage\n\n### 1. Import the script.\n\n```html\n\u003cscript type=\"text/javascript\" src=\"jLouvain.js\"\u003e\u003c/script\u003e\n```\n\n### 2. Sample Data Format\n\n#### Node Data\n\n```javascript\nlet node_data = ['id1', 'id2', 'id3']; // any type of string can be used as id\n```\n\n#### Edge Data\n\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\n#### (Optional) Partition Data\n\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```\n\n### 3. Run the algorithm\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\n```javascript\nlet community = jLouvain()\n\t.nodes(node_data)\n\t.edges(edge_data)\n\t.partition_init(init_part);\nlet result = community();\n```\n\n## Example\n\nSee **example.html**, use the console to view the raw input data and raw output.\n\nInitial input graph for community detection.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupphiminn%2FjLouvain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupphiminn%2FjLouvain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupphiminn%2FjLouvain/lists"}