graph

GPU-accelerated force graph layout and rendering

https://github.com/cosmosgl/graph

Science Score: 44.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
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.8%) to scientific vocabulary

Keywords

embeddings force graph network simulation visualization webgl

Keywords from Contributors

mesh interpretability sequences generic projection interactive optim hacking network-simulation
Last synced: 4 months ago · JSON representation ·

Repository

GPU-accelerated force graph layout and rendering

Basic Info
Statistics
  • Stars: 1,005
  • Watchers: 10
  • Forks: 62
  • Open Issues: 8
  • Releases: 15
Topics
embeddings force graph network simulation visualization webgl
Created over 3 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing Code of conduct Citation Security Governance

README.md

cosmos.gl logo

GPU-accelerated Force Graph

cosmos.gl is a high-performance WebGL Force Graph algorithm and rendering engine. All the computations and drawing occur on the GPU in fragment and vertex shaders, avoiding expensive memory operations. It enables the real-time simulation of network graphs consisting of hundreds of thousands of points and links on modern hardware.

This engine powers 🪐 Cosmograph — a toolset for exploring complex networks and AI embeddings.

📺 Comparison with other libraries

🎮 Check out our storybook for examples


Quick Start

Install the package:

bash npm install @cosmos.gl/graph

Get the data, configure the graph and run the simulation:

```javascript import { Graph } from '@cosmos.gl/graph'

const div = document.querySelector('div') const config = { spaceSize: 4096, simulationFriction: 0.1, // keeps the graph inert simulationGravity: 0, // disables the gravity force simulationRepulsion: 0.5, // increases repulsion between points curvedLinks: true, // curved links fitViewOnInit: true, // fit the view to the graph after initialization fitViewDelay: 1000, // wait 1 second before fitting the view fitViewPadding: 0.3, // centers the graph with a padding of ~30% of screen rescalePositions: false, // rescale positions, useful when coordinates are too small enableDrag: true, // enable dragging points onClick: (pointIndex) => { console.log('Clicked point index: ', pointIndex) }, /* ... */ }

const graph = new Graph(div, config)

// Points: [x1, y1, x2, y2, x3, y3] const pointPositions = new Float32Array([ 0.0, 0.0, // Point 1 at (0,0) 1.0, 0.0, // Point 2 at (1,0) 0.5, 1.0, // Point 3 at (0.5,1) ]);

graph.setPointPositions(pointPositions)

// Links: [sourceIndex1, targetIndex1, sourceIndex2, targetIndex2] const links = new Float32Array([ 0, 1, // Link from point 0 to point 1 1, 2, // Link from point 1 to point 2 2, 0, // Link from point 2 to point 0 ]);

graph.setLinks(links)

graph.render() ```


What's New in v2.0?

cosmos.gl v2.0 introduces significant improvements in performance and data handling:

  • Enhanced data structures with WebGL-compatible formats.
  • Methods like setPointPositions and setLinks replace setData for improved efficiency.
  • Direct control over point and link attributes via Float32Array (e.g., colors, sizes, widths).
  • Updated event handling based on indices instead of objects.
  • New Point Clustering force (setPointClusters, setClusterPositions and setPointClusterStrength).
  • Ability to drag points.

Check the Migration Guide for details.


Examples


Showcase (via cosmograph.app)


Known Issues

  • ~~Starting from version 15.4, iOS has stopped supporting the key WebGL extension powering our Many-Body force implementation (EXT_float_blend). We're investigating this issue and exploring solutions.~~ The latest iOS works again!
  • cosmos.gl doesn't work on Android devices that don't support the OES_texture_float WebGL extension.

Documentation


License

MIT


Contact

GitHub Discussions

Owner

  • Name: cosmos.gl
  • Login: cosmosgl
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Rokotyan
  given-names: Nikita
  email: nikita@rokotyan.com
- family-names: Stukova
  given-names: Olga
- family-names: Ovsyannikov
  given-names: Denis
title: "Cosmograph: GPU-accelerated Force Graph Layout and Rendering"
version: 2.0.0
date-released: 2024-12-20
url: "https://cosmograph.app"
repository-code: 'https://github.com/cosmosgl/graph'
repository-artifact: 'https://www.npmjs.com/package/@cosmos.gl/graph'
keywords:
  - Force Graph
  - GPU
  - WebGL
  - Embedding
  - Visualization
license: MIT

GitHub Events

Total
  • Fork event: 3
  • Create event: 18
  • Release event: 3
  • Issues event: 10
  • Watch event: 48
  • Delete event: 3
  • Issue comment event: 22
  • Member event: 1
  • Push event: 56
  • Pull request review comment event: 48
  • Gollum event: 6
  • Pull request review event: 72
  • Pull request event: 37
Last Year
  • Fork event: 3
  • Create event: 18
  • Release event: 3
  • Issues event: 10
  • Watch event: 48
  • Delete event: 3
  • Issue comment event: 22
  • Member event: 1
  • Push event: 56
  • Pull request review comment event: 48
  • Gollum event: 6
  • Pull request review event: 72
  • Pull request event: 37

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 266
  • Total Committers: 7
  • Avg Commits per committer: 38.0
  • Development Distribution Score (DDS): 0.188
Past Year
  • Commits: 140
  • Committers: 4
  • Avg Commits per committer: 35.0
  • Development Distribution Score (DDS): 0.143
Top Committers
Name Email Commits
Stukova Olya s****o@g****m 216
Nikita Rokotyan n****a@r****m 38
dependabot[bot] 4****] 8
Simone Ceccarelli c****1@g****m 1
HerkTG 5****G 1
dasha c****s@g****m 1
WanQiyang w****y@f****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: over 2 years
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 6.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
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
  • janwillemtulp (2)
  • connebs (1)
  • unidesigner (1)
  • taywrobel (1)
  • GoodNovember (1)
  • abhishekvash-tl (1)
Pull Request Authors
  • Stukova (15)
  • rokotyan (3)
  • babel-leader (2)
  • Santhosh9918 (1)
Top Labels
Issue Labels
enhancement (3)
Pull Request Labels

Dependencies

package-lock.json npm
  • 429 dependencies
package.json npm
  • @rollup/plugin-alias ^3.1.9 development
  • @rollup/plugin-commonjs ^22.0.1 development
  • @rollup/plugin-node-resolve ^13.3.0 development
  • @types/d3-color ^3.1.0 development
  • @types/d3-selection ^3.0.2 development
  • @types/d3-transition ^3.0.1 development
  • @types/d3-zoom ^3.0.1 development
  • @typescript-eslint/eslint-plugin ^5.30.5 development
  • @typescript-eslint/parser ^5.30.5 development
  • @zerollup/ts-transform-paths ^1.7.18 development
  • eslint ^8.19.0 development
  • eslint-config-standard ^17.0.0 development
  • eslint-plugin-import ^2.26.0 development
  • eslint-plugin-node ^11.1.0 development
  • eslint-plugin-promise ^6.0.0 development
  • eslint-plugin-unicorn ^43.0.1 development
  • lint-staged ^13.0.3 development
  • pre-commit ^1.2.2 development
  • rollup ^2.76.0 development
  • rollup-plugin-glslify ^1.3.0 development
  • rollup-plugin-typescript2 ^0.32.1 development
  • ttypescript ^1.5.13 development
  • typescript ^4.7.4 development
  • d3-color ^3.1.0
  • d3-selection ^3.0.0
  • d3-transition ^3.0.1
  • d3-zoom ^3.0.0
  • gl-bench ^1.0.42
  • gl-matrix ^3.4.3
  • regl ^2.1.0