10–500× Faster than Pure JS
Rust/WASM core delivers PageRank on 10k nodes in ~100ms. Betweenness centrality in seconds instead of minutes. Same algorithms, native speed.
The igraph for JavaScript — 400+ graph algorithms powered by Rust/WASM. Community detection, centrality, layout, flow, isomorphism. Tree-shakable. TypeScript. Browser & Node.js.
npm install @graphrs/core @graphrs/community @graphrs/centralityimport { Graph } from '@graphrs/core';
import { louvain } from '@graphrs/community';
import { pagerank } from '@graphrs/centrality';
const graph = Graph.fromEdges([
[0, 1], [1, 2], [2, 0], // cluster A
[3, 4], [4, 5], [5, 3], // cluster B
[2, 3], // bridge
]);
const communities = await louvain(graph);
// → { membership: [0,0,0,1,1,1], modularity: 0.357 }
const pr = await pagerank(graph);
// → { scores: [0.12, 0.15, 0.23, 0.18, 0.16, 0.16] }Python has igraph (C core, fast) and networkx (pure Python, slow). JavaScript had nothing in the fast category — until now.
| graphology | cytoscape.js | @graphrs | |
|---|---|---|---|
| Community detection | 2 algorithms | 0 | 10+ |
| Centrality measures | 7 | 2 | 15+ |
| Layout algorithms | 3 | ext | 16 |
| Network flow | 0 | 0 | Full |
| Isomorphism | 0 | 0 | VF2 |
| 10k nodes PageRank | ~5–10 s | N/A | ~100 ms |
# AntV G6 — layout + community detection + centrality
npm install @graphrs/g6
# React Flow — auto-layout hook (React Flow has ZERO built-in layout)
npm install @graphrs/react-flow// G6: plug-and-play layout
import { createGraphrsLayout } from '@graphrs/g6';
new G6Graph({ layout: createGraphrsLayout({ algorithm: 'fruchterman-reingold' }) });
// React Flow: one-line auto-layout
import { useGraphrsLayout } from '@graphrs/react-flow';
const { nodes, edges } = useGraphrsLayout(initialNodes, initialEdges);