Skip to content

Commit 1a8f3c1

Browse files
authored
feat: impl page rank (#64)
* feat: impl page rank * feat: sssp impl * fix: use rayon to spawn threads instead of std:threads * chore: commit pnpm lockfile * feat: js impl fo louvain * feat: rust impl for louvain
1 parent 142b3f4 commit 1a8f3c1

File tree

145 files changed

+13363
-50129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+13363
-50129
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on: ["push", "pull_request"]
4+
5+
jobs:
6+
ci:
7+
runs-on: ubuntu-20.04
8+
strategy:
9+
matrix:
10+
node-version: [15]
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: pnpm/action-setup@v2
14+
with:
15+
version: 7
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: "pnpm"
21+
- name: Install dependencies
22+
run: pnpm install
23+
- name: lint
24+
run: |
25+
pnpm lint
26+
- name: build
27+
run: |
28+
pnpm build:ci
29+
- name: test
30+
run: |
31+
pnpm test

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ es
1111
dist
1212
*.pem
1313
!mock-cert.pem
14-
pnpm-lock.yaml
1514
tsconfig.tsbuildinfo
15+
target
16+
Cargo.lock
17+
pkg
18+
pkg-node
19+
pkg-parallel

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

CHANGELOG.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

README-zh_CN.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,64 @@
1-
### AntV Algorithm
1+
<h1 align="center">
2+
<b>AntV Algorithm</b>
3+
</h1>
24

3-
It is an algorithm package of AntV, mainly includes graph related algorithms:
4-
- **Community Detection**
5-
- k-core: K-Core community detection algorithm -- Find the closely related subgraph structure that conforms to the specified core degree K
6-
- louvain: LOUVAIN algorithm -- Divide communities according to Modularity
7-
- i-louvain: I-LOUVAIN algorithm -- Divide communities according to Modularity and Inertial Modularity (properties similarity)
8-
- labelPropagation: Label Propagation(LP) clustering algorithm
9-
- minimumSpanningTree: Generate the minimum spanning tree for a graph
5+
[![Build Status](https://github.com/antvis/algorithm/workflows/build/badge.svg?branch=next)](https://github.com/antvis//actions)
6+
[![Coverage Status](https://img.shields.io/coveralls/github/antvis/algorithm/next.svg)](https://coveralls.io/github/antvis/algorithm?branch=next)
7+
[![npm Download](https://img.shields.io/npm/dm/@antv/graph.svg)](https://www.npmjs.com/package/@antv/graph)
8+
[![npm License](https://img.shields.io/npm/l/@antv/graph.svg)](https://www.npmjs.com/package/@antv/graph)
109

11-
- **nodes clustering**
12-
- k-means: K-Means algorithm - Cluster nodes into K clusters according to the distance between node
10+
- [@antv/graph](./packages/graph/README.md) [![npm Version](https://img.shields.io/npm/v/@antv/graph/alpha)](https://www.npmjs.com/package/@antv/graph) Implemented with TypeScript. [Online Demo](https://observablehq.com/d/2db6b0cc5e97d8d6)
11+
- [@antv/graph-rust](./packages/graph-rust/README.md) Implemented with Rust.
12+
- [@antv/graph-wasm](./packages/graph-wasm/README.md) [![npm Version](https://img.shields.io/npm/v/@antv/graph-wasm)](https://www.npmjs.com/package/@antv/graph-wasm) Provide a WASM binding of `@antv/graph-rust`. [Online Demo](https://observablehq.com/d/288c16a54543a141)
13+
- [@antv/graph-gpu](./packages/graph-gpu/README.md) [![npm Version](https://img.shields.io/npm/v/@antv/graph-gpu)](https://www.npmjs.com/package/@antv/graph-gpu) Accelerate some parallelizable algorithms such as Fruchterman with WebGPU which has a better performance under large amount of data.
1314

14-
- **Similarity**
15-
- cosineSimilarity: Cosine Similarity algorithm -- Calculate cosine similarity
16-
- nodesCosineSimilarity: Nodes Cosine Similarity algorithm -- Calculate the cosine similarity between other nodes and seed node
15+
It is an algorithm package of AntV, mainly includes graph related algorithms:
1716

1817
- **Centrality**
1918
- pageRank: page rank algorithm for nodes ranking
20-
- degree: calculate the in degree, out degree, and total degree for nodes
21-
22-
- **Path**
23-
- dijkstra: Dijkstra shortest path algorithm
24-
- findPath: Find the shortest paths and all paths for two nodes by Dijkstra
25-
- floydWarshall: Floyd Warshall shortest path algorithm
26-
27-
- **Other**
28-
- neighbors: Find the neighbors for a node in the graph
29-
- GADDI: graph structural and semantic pattern matching algorithm
30-
- detectCycle: Detect the cycles of the graph data
31-
- dfs: Depth-First search algorithm
32-
- adjacentMatrix: calculate the adjacency matrix for graph data
33-
- connectedComponent: Calculate the connected components for graph data
34-
35-
All the algorithms above supports to be calculated with web-worker.
19+
20+
## Development
21+
22+
We use [Vite](https://vitejs.dev/) to start a dev server:
23+
24+
```bash
25+
$ pnpm dev
26+
```
27+
28+
## Test
29+
30+
Run all the test cases with Jest:
31+
32+
```bash
33+
$ pnpm test
34+
```
35+
36+
## Publish
37+
38+
Using Changesets with pnpm: https://pnpm.io/next/using-changesets
39+
40+
The generated markdown files in the .changeset directory should be committed to the repository.
41+
42+
```bash
43+
pnpm changeset
44+
```
45+
46+
This will bump the versions of the packages previously specified with pnpm changeset (and any dependents of those) and update the changelog files.
47+
48+
```bash
49+
pnpm changeset version
50+
```
51+
52+
Commit the changes. This command will publish all packages that have bumped versions not yet present in the registry.
53+
54+
```bash
55+
pnpm publish -r
56+
```
57+
58+
If you want to publish versions for test:
59+
60+
```bash
61+
pnpm changeset pre enter alpha
62+
pnpm changeset pre enter beta
63+
pnpm changeset pre enter rc
64+
```

0 commit comments

Comments
 (0)