{"id":45882969,"url":"https://github.com/neesjanvaneck/networkanalysis-ts","last_synced_at":"2026-02-27T14:55:21.902Z","repository":{"id":89639744,"uuid":"530372080","full_name":"neesjanvaneck/networkanalysis-ts","owner":"neesjanvaneck","description":"TypeScript port of the Java networkanalysis package that provides data structures and algorithms for network analysis.","archived":false,"fork":false,"pushed_at":"2022-10-18T17:41:01.000Z","size":816,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-27T02:47:40.419Z","etag":null,"topics":["clustering","clustering-algorithm","community-detection","layout","layout-algorithm","leiden-algorithm","louvain-algorithm","mapping","network-analysis","typescript","vos-technique"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/neesjanvaneck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-29T19:52:36.000Z","updated_at":"2026-01-16T08:27:23.000Z","dependencies_parsed_at":"2023-11-16T00:09:46.572Z","dependency_job_id":"67ba563b-56dd-4b43-af48-e27a6fd5060d","html_url":"https://github.com/neesjanvaneck/networkanalysis-ts","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"1c32749c61ac0d60c40d0288a96d49b168f2416d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/neesjanvaneck/networkanalysis-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neesjanvaneck%2Fnetworkanalysis-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neesjanvaneck%2Fnetworkanalysis-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neesjanvaneck%2Fnetworkanalysis-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neesjanvaneck%2Fnetworkanalysis-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neesjanvaneck","download_url":"https://codeload.github.com/neesjanvaneck/networkanalysis-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neesjanvaneck%2Fnetworkanalysis-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29900641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clustering","clustering-algorithm","community-detection","layout","layout-algorithm","leiden-algorithm","louvain-algorithm","mapping","network-analysis","typescript","vos-technique"],"created_at":"2026-02-27T14:55:21.328Z","updated_at":"2026-02-27T14:55:21.897Z","avatar_url":"https://github.com/neesjanvaneck.png","language":"TypeScript","readme":"# networkanalysis-ts\n\n[![Build main branch](https://github.com/neesjanvaneck/networkanalysis-ts/workflows/Build%20main%20branch/badge.svg?branch=main)](https://github.com/neesjanvaneck/networkanalysis-ts/actions)\n[![License: MIT](https://badgen.net/github/license/neesjanvaneck/networkanalysis-ts?label=License\u0026color=yellow)](https://github.com/neesjanvaneck/networkanalysis-ts/blob/main/LICENSE)\n[![Latest release](https://badgen.net/github/release/neesjanvaneck/networkanalysis-ts?label=Release)](https://github.com/neesjanvaneck/networkanalysis-ts/releases)\n[![npm version](https://badgen.net/npm/v/networkanalysis-ts)](https://www.npmjs.com/package/networkanalysis-ts)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7221171.svg)](https://doi.org/10.5281/zenodo.7221171)\n\nThis package is a TypeScript port of the [networkanalysis](https://github.com/CWTSLeiden/networkanalysis) package written in Java. The package provides algorithms and data structures for network analysis. Currently, the package focuses on clustering (or community detection) and layout (or mapping) of networks. In particular, the package contains an implementation of the [Leiden algorithm](https://doi.org/10.1038/s41598-019-41695-z) and the [Louvain algorithm](https://doi.org/10.1088/1742-5468/2008/10/P10008) for network clustering and the [VOS technique](https://doi.org/10.1002/asi.21421) for network layout. Only undirected networks are supported.\n\nThe networkanalysis-ts package was developed by [Nees Jan van Eck](https://orcid.org/0000-0001-8448-4521) at the [Centre for Science and Technology Studies (CWTS)](https://www.cwts.nl) at [Leiden University](https://www.universiteitleiden.nl/en) and benefited from contributions by [Olya Stukova](https://github.com/Stukova) and [Nikita Rokotyan](https://github.com/Rokotyan) from [Interacta](https://interacta.io). The networkanalysis package written in Java on which networkanalysis-ts is based was developed by [Vincent Traag](https://orcid.org/0000-0003-3170-3879), [Nees Jan van Eck](https://orcid.org/0000-0001-8448-4521), and [Ludo Waltman](https://orcid.org/0000-0001-8249-1752).\n\n## Documentation\n\nDocumentation of the source code of networkanalysis-ts is provided in the code in `TSDoc` format. The documentation is also available in a [compiled format](https://neesjanvaneck.github.io/networkanalysis-ts).\n\n## Installation\n\n```sh\nnpm install networkanalysis-ts\n```\n\n## Usage\n\nThe following code snippet demonstrates how the core classes in networkanalysis-ts can be used to create a network and to perform network normalization, clustering, and layout:\n\n```typescript\nimport { Clustering, GradientDescentVOSLayoutAlgorithm, Layout, LeidenAlgorithm, Network } from 'networkanalysis-ts'\n\nconst nRandomStarts = 10\n\n// Construct network.\nconst nNodes = 6\nconst edges = [[0, 1, 2, 2, 3, 5, 4], [1, 2, 0, 3, 5, 4, 3]]\nconst network = new Network({\n  nNodes: nNodes,\n  setNodeWeightsToTotalEdgeWeights: true,\n  edges: edges,\n  sortedEdges: false,\n  checkIntegrity: true,\n})\n\n// Perform network normalization.\nconst normalizedNetwork = network.createNormalizedNetworkUsingAssociationStrength()\n\n// Perform clustering.\nlet bestClustering: Clustering | undefined\nlet maxQuality = Number.NEGATIVE_INFINITY\nconst clusteringAlgorithm = new LeidenAlgorithm()\nclusteringAlgorithm.setResolution(0.2)\nclusteringAlgorithm.setNIterations(50)\nfor (let i = 0; i \u003c nRandomStarts; i++) {\n  const clustering = new Clustering({ nNodes: normalizedNetwork.getNNodes() })\n  clusteringAlgorithm.improveClustering(normalizedNetwork, clustering)\n  const quality = clusteringAlgorithm.calcQuality(normalizedNetwork, clustering)\n  if (quality \u003e maxQuality) {\n    bestClustering = clustering\n    maxQuality = quality\n  }\n}\nbestClustering?.orderClustersByNNodes()\n\n// Perform layout.\nlet bestLayout: Layout | undefined\nlet minQuality = Number.POSITIVE_INFINITY\nconst layoutAlgorithm = new GradientDescentVOSLayoutAlgorithm();\nlayoutAlgorithm.setAttraction(2)\nlayoutAlgorithm.setRepulsion(1)\nfor (let i = 0; i \u003c nRandomStarts; i++) {\n  const layout = new Layout({ nNodes: normalizedNetwork.getNNodes() })\n  layoutAlgorithm.improveLayout(normalizedNetwork, layout)\n  const quality = layoutAlgorithm.calcQuality(normalizedNetwork, layout)\n  if (quality \u003c minQuality) {\n    bestLayout = layout\n    minQuality = quality\n  }\n}\nbestLayout?.standardize(true)\n```\n\nThe package also includes a `run` module that provides helper classes for running the network analysis algorithms in an easier way. The following code snippet demonstrates the use of the helper classes for constructing a network and for performing network clustering and layout:\n\n```typescript\nimport { Node, Link, NetworkClustering, NetworkLayout } from 'networkanalysis-ts/run'\n\n// Construct network.\nconst nodes: Node[] = [\n  { id: 'James' },\n  { id: 'Mary' },\n  { id: 'John' },\n  { id: 'Linda' },\n  { id: 'David' },\n  { id: 'Karen' },\n]\nconst links: Link[] = [\n  { node1: nodes[0], node2: nodes[1] },\n  { node1: nodes[1], node2: nodes[2] },\n  { node1: nodes[2], node2: nodes[0] },\n  { node1: nodes[2], node2: nodes[3] },\n  { node1: nodes[3], node2: nodes[5] },\n  { node1: nodes[5], node2: nodes[4] },\n  { node1: nodes[4], node2: nodes[3] },\n]\n\n// Perform clustering.\nnew NetworkClustering()\n  .data(nodes, links)\n  .qualityFunction('CPM')\n  .normalization('AssociationStrength')\n  .resolution(0.2)\n  .minClusterSize(1)\n  .algorithm('Leiden')\n  .randomStarts(10)\n  .iterations(50)\n  .randomness(0.01)\n  .seed(0)\n  .run()\n\n// Perform layout.\nnew NetworkLayout()\n  .data(nodes, links)\n  .qualityFunction('VOS')\n  .normalization('AssociationStrength')\n  .attraction(2)\n  .repulsion(1)\n  .randomStarts(10)\n  .seed(0)\n  .run()\n```\n\n## Demo app\n\nThe GitHub repository of networkanalys-ts also provides a [Svelt](https://svelte.dev) demo app that uses the helper classes discussed above. The source code of the demo app is available in the `app/` folder. The following screenshot shows the output of the demo app when applying it to a journal co-citation network:\n\n\u003cimg src=\"https://github.com/neesjanvaneck/networkanalysis-ts/blob/main/app/assets/images/networkanalysis-ts-demo-app.png?raw=true\" alt=\"networkanalysis-ts demo app\" style=\"width: 100%; max-width: 800px; height: auto;\"\u003e\n\n## License\n\nThe networkanalysis-ts package is distributed under the [MIT license](LICENSE).\n\n## Issues\n\nIf you encounter any issues, please report them using the [issue tracker](https://github.com/neesjanvaneck/networkanalysis-ts/issues) on GitHub.\n\n## Contribution\n\nYou are welcome to contribute to the development of networkanalysis-ts. Please follow the typical GitHub workflow: Fork from this repository and make a pull request to submit your changes. Make sure that your pull request has a clear description and that the code has been properly tested.\n\n## Development and deployment\n\nThe latest stable version of the code is available from the [`main`](https://github.com/neesjanvaneck/networkanalysis-ts/tree/main) branch on GitHub. The most recent code, which may be under development, is available from the [`develop`](https://github.com/neesjanvaneck/networkanalysis-ts/tree/develop) branch.\n\n### Requirements\n\nTo run networkanalysis-ts locally and to build production-ready bundles, [Node.js](https://nodejs.org) and [npm](https://www.npmjs.com) need to be installed on your system.\n\n### Setup\n\nRun\n```sh\nnpm install\n```\nto install all required Node.js packages.\n\n### Development\n\nRun\n```sh\nnpm run dev\n```\nto build a development version of the demo app and serve it with hot reload at [http://localhost:6800](http://localhost:6800).\n\n### Deployment\n\nRun\n```sh\nnpm run build:lib\n```\nto build a deployment version of the package. The output is stored in the `lib/` folder.\n\nRun\n```sh\nnpm run build:app\n```\nto build a deployment version of the demo app. The output is stored in the `dist/` folder.\n\nRun\n```sh\nnpm run build\n```\nto build a deployment version of both the package and the demo app.\n\n### References\n\n\u003e Traag, V.A., Waltman, L., \u0026 Van Eck, N.J. (2019). From Louvain to Leiden: Guaranteeing well-connected communities. *Scientific Reports*, 9, 5233. https://doi.org/10.1038/s41598-019-41695-z\n\n\u003e Van Eck, N.J., Waltman, L., Dekker, R., \u0026 Van den Berg, J. (2010). A comparison of two techniques for bibliometric mapping: Multidimensional scaling and VOS. *Journal of the American Society for Information Science and Technology*, 61(12), 2405-2416. https://doi.org/10.1002/asi.21421\n\n\u003e Waltman, L., Van Eck, N.J., \u0026 Noyons, E.C.M. (2010). A unified approach to mapping and clustering of bibliometric networks. *Journal of Informetrics*, 4(4), 629-635. https://doi.org/10.1016/j.joi.2010.07.002\n\n\u003e Van Eck, N.J., \u0026 Waltman, L. (2009). How to normalize co-occurrence data? An analysis of some well-known similarity measures. *Journal of the American Society for Information Science and Technology*, 60(8), 1635-1651. https://doi.org/10.1002/asi.21075\n\n\u003e Blondel, V.D., Guillaume, J.-L., Lambiotte, R., \u0026 Lefebvre, E. (2008). Fast unfolding of communities in large networks. *Journal of Statistical Mechanics: Theory and Experiment*, 10, P10008. https://doi.org/10.1088/1742-5468/2008/10/P10008 \n\n\u003e Newman, M.E.J. \u0026 Girvan, M. (2004). Finding and evaluating community structure in networks. *Physical Review E*, 69(2), 026113, https://doi.org/10.1103/PhysRevE.69.026113.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneesjanvaneck%2Fnetworkanalysis-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneesjanvaneck%2Fnetworkanalysis-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneesjanvaneck%2Fnetworkanalysis-ts/lists"}