networkanalysis-ts

TypeScript port of the Java networkanalysis package that provides data structures and algorithms for network analysis.

https://github.com/neesjanvaneck/networkanalysis-ts

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 21 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

clustering clustering-algorithm community-detection layout layout-algorithm leiden-algorithm louvain-algorithm mapping network-analysis typescript vos-technique

Keywords from Contributors

mesh interactive
Last synced: 4 months ago · JSON representation ·

Repository

TypeScript port of the Java networkanalysis package that provides data structures and algorithms for network analysis.

Basic Info
  • Host: GitHub
  • Owner: neesjanvaneck
  • License: mit
  • Language: TypeScript
  • Default Branch: main
  • Homepage:
  • Size: 797 KB
Statistics
  • Stars: 13
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
clustering clustering-algorithm community-detection layout layout-algorithm leiden-algorithm louvain-algorithm mapping network-analysis typescript vos-technique
Created over 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

networkanalysis-ts

Build main branch License: MIT Latest release npm version DOI

This package is a TypeScript port of the 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 and the Louvain algorithm for network clustering and the VOS technique for network layout. Only undirected networks are supported.

The networkanalysis-ts package was developed by Nees Jan van Eck at the Centre for Science and Technology Studies (CWTS) at Leiden University and benefited from contributions by Olya Stukova and Nikita Rokotyan from Interacta. The networkanalysis package written in Java on which networkanalysis-ts is based was developed by Vincent Traag, Nees Jan van Eck, and Ludo Waltman.

Documentation

Documentation of the source code of networkanalysis-ts is provided in the code in TSDoc format. The documentation is also available in a compiled format.

Installation

sh npm install networkanalysis-ts

Usage

The 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:

```typescript import { Clustering, GradientDescentVOSLayoutAlgorithm, Layout, LeidenAlgorithm, Network } from 'networkanalysis-ts'

const nRandomStarts = 10

// Construct network. const nNodes = 6 const edges = [[0, 1, 2, 2, 3, 5, 4], [1, 2, 0, 3, 5, 4, 3]] const network = new Network({ nNodes: nNodes, setNodeWeightsToTotalEdgeWeights: true, edges: edges, sortedEdges: false, checkIntegrity: true, })

// Perform network normalization. const normalizedNetwork = network.createNormalizedNetworkUsingAssociationStrength()

// Perform clustering. let bestClustering: Clustering | undefined let maxQuality = Number.NEGATIVE_INFINITY const clusteringAlgorithm = new LeidenAlgorithm() clusteringAlgorithm.setResolution(0.2) clusteringAlgorithm.setNIterations(50) for (let i = 0; i < nRandomStarts; i++) { const clustering = new Clustering({ nNodes: normalizedNetwork.getNNodes() }) clusteringAlgorithm.improveClustering(normalizedNetwork, clustering) const quality = clusteringAlgorithm.calcQuality(normalizedNetwork, clustering) if (quality > maxQuality) { bestClustering = clustering maxQuality = quality } } bestClustering?.orderClustersByNNodes()

// Perform layout. let bestLayout: Layout | undefined let minQuality = Number.POSITIVE_INFINITY const layoutAlgorithm = new GradientDescentVOSLayoutAlgorithm(); layoutAlgorithm.setAttraction(2) layoutAlgorithm.setRepulsion(1) for (let i = 0; i < nRandomStarts; i++) { const layout = new Layout({ nNodes: normalizedNetwork.getNNodes() }) layoutAlgorithm.improveLayout(normalizedNetwork, layout) const quality = layoutAlgorithm.calcQuality(normalizedNetwork, layout) if (quality < minQuality) { bestLayout = layout minQuality = quality } } bestLayout?.standardize(true) ```

The 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:

```typescript import { Node, Link, NetworkClustering, NetworkLayout } from 'networkanalysis-ts/run'

// Construct network. const nodes: Node[] = [ { id: 'James' }, { id: 'Mary' }, { id: 'John' }, { id: 'Linda' }, { id: 'David' }, { id: 'Karen' }, ] const links: Link[] = [ { node1: nodes[0], node2: nodes[1] }, { node1: nodes[1], node2: nodes[2] }, { node1: nodes[2], node2: nodes[0] }, { node1: nodes[2], node2: nodes[3] }, { node1: nodes[3], node2: nodes[5] }, { node1: nodes[5], node2: nodes[4] }, { node1: nodes[4], node2: nodes[3] }, ]

// Perform clustering. new NetworkClustering() .data(nodes, links) .qualityFunction('CPM') .normalization('AssociationStrength') .resolution(0.2) .minClusterSize(1) .algorithm('Leiden') .randomStarts(10) .iterations(50) .randomness(0.01) .seed(0) .run()

// Perform layout. new NetworkLayout() .data(nodes, links) .qualityFunction('VOS') .normalization('AssociationStrength') .attraction(2) .repulsion(1) .randomStarts(10) .seed(0) .run() ```

Demo app

The GitHub repository of networkanalys-ts also provides a Svelt 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:

networkanalysis-ts demo app

License

The networkanalysis-ts package is distributed under the MIT license.

Issues

If you encounter any issues, please report them using the issue tracker on GitHub.

Contribution

You 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.

Development and deployment

The latest stable version of the code is available from the main branch on GitHub. The most recent code, which may be under development, is available from the develop branch.

Requirements

To run networkanalysis-ts locally and to build production-ready bundles, Node.js and npm need to be installed on your system.

Setup

Run sh npm install to install all required Node.js packages.

Development

Run sh npm run dev to build a development version of the demo app and serve it with hot reload at http://localhost:6800.

Deployment

Run sh npm run build:lib to build a deployment version of the package. The output is stored in the lib/ folder.

Run sh npm run build:app to build a deployment version of the demo app. The output is stored in the dist/ folder.

Run sh npm run build to build a deployment version of both the package and the demo app.

References

Traag, V.A., Waltman, L., & 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

Van Eck, N.J., Waltman, L., Dekker, R., & 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

Waltman, L., Van Eck, N.J., & 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

Van Eck, N.J., & 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

Blondel, V.D., Guillaume, J.-L., Lambiotte, R., & 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

Newman, M.E.J. & Girvan, M. (2004). Finding and evaluating community structure in networks. Physical Review E, 69(2), 026113, https://doi.org/10.1103/PhysRevE.69.026113.

Owner

  • Name: Nees Jan van Eck
  • Login: neesjanvaneck
  • Kind: user
  • Location: Leiden, The Netherlands
  • Company: @CWTSLeiden

Senior researcher @CWTSLeiden

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it using the metadata from this file."
type: "software"
authors:
  - family-names: "van Eck"
    given-names: "Nees Jan"
    orcid: "https://orcid.org/0000-0001-8448-4521"
    email: "ecknjpvan@cwts.leidenuniv.nl"
    affiliation: "Centre for Science and Technology Studies (CWTS), Leiden University"
title: "networkanalysis-ts"
abstract: "This package is a TypeScript port of the 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 and the Louvain algorithm for network clustering and the VOS technique for network layout. Only undirected networks are supported."
keywords:
  - network analysis
  - clustering
  - community detection
  - clustering algorithm
  - Leiden algorithm
  - Louvain algorithm
  - layout
  - mapping
  - layout algorithm
  - VOS technique
  - typescript
url: "https://github.com/neesjanvaneck/networkanalysis-ts#readme"
repository-code: "https://github.com/neesjanvaneck/networkanalysis-ts"
repository-artifact: "https://www.npmjs.com/package/networkanalysis-ts"
license: MIT
doi: 10.5281/zenodo.7221171
version: 1.0.0
date-released: 2022-08-29

GitHub Events

Total
  • Watch event: 4
Last Year
  • Watch event: 4

Committers

Last synced: almost 2 years ago

All Time
  • Total Commits: 7
  • Total Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.143
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Nees Jan van Eck e****n@c****l 6
dependabot[bot] 4****] 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (1)

Packages

  • Total packages: 1
  • Total downloads:
    • npm 1,382 last-month
  • Total dependent packages: 4
  • Total dependent repositories: 1
  • Total versions: 1
  • Total maintainers: 1
npmjs.org: networkanalysis-ts

TypeScript port of the Java networkanalysis package that provides data structures and algorithms for network analysis.

  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 1
  • Downloads: 1,382 Last month
Rankings
Downloads: 2.7%
Dependent packages count: 4.5%
Average: 8.9%
Dependent repos count: 10.3%
Stargazers count: 11.5%
Forks count: 15.4%
Maintainers (1)
Last synced: 5 months ago

Dependencies

.github/workflows/build-develop.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
.github/workflows/build-main.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
package-lock.json npm
  • 634 dependencies
package.json npm
  • @rollup/plugin-alias ^3.1.9 development
  • @rollup/plugin-commonjs ^16.0.0 development
  • @rollup/plugin-node-resolve ^10.0.0 development
  • @types/d3 ^7.4.0 development
  • @types/papaparse ^5.3.4 development
  • @typescript-eslint/eslint-plugin ^4.7.0 development
  • @typescript-eslint/parser ^4.7.0 development
  • cross-env ^7.0.3 development
  • d3 ^7.6.1 development
  • eslint ^7.13.0 development
  • eslint-config-standard ^16.0.1 development
  • eslint-plugin-import ^2.22.1 development
  • eslint-plugin-node ^11.1.0 development
  • eslint-plugin-promise ^4.2.1 development
  • eslint-plugin-standard ^4.1.0 development
  • eslint-plugin-svelte3 ^2.7.3 development
  • husky ^4.3.6 development
  • lint-staged ^10.5.3 development
  • papaparse ^5.3.0 development
  • rollup ^2.33.1 development
  • rollup-plugin-html2 ^2.0.0 development
  • rollup-plugin-livereload ^2.0.5 development
  • rollup-plugin-node-builtins ^2.1.2 development
  • rollup-plugin-node-globals ^1.4.0 development
  • rollup-plugin-postcss ^4.0.2 development
  • rollup-plugin-serve ^1.1.0 development
  • rollup-plugin-string ^3.0.0 development
  • rollup-plugin-svelte ^6.1.1 development
  • rollup-plugin-terser ^7.0.2 development
  • rollup-plugin-typescript2 ^0.33.0 development
  • svelte ^3.49.0 development
  • svelte-preprocess ^4.10.7 development
  • tslib ^2.4.0 development
  • typedoc ^0.22.18 development
  • typescript ^4.7.4 development
  • java-random ^0.4.0