Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build

on: ["push", "pull_request"]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [15]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: lint
run: |
pnpm lint
- name: build
run: |
pnpm build:ci
- name: test
run: |
pnpm test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ es
dist
*.pem
!mock-cert.pem
tsconfig.tsbuildinfo
target
Cargo.lock
pkg
pkg-node
pkg-parallel
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
40 changes: 0 additions & 40 deletions README-zh_CN.md

This file was deleted.

87 changes: 58 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,64 @@
### AntV Algorithm
<h1 align="center">
<b>AntV Algorithm</b>
</h1>

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

- **nodes clustering**
- k-means: K-Means algorithm - Cluster nodes into K clusters according to the distance between node
- [@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)
- [@antv/graph-rust](./packages/graph-rust/README.md) Implemented with Rust.
- [@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)
- [@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.

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

- **Centrality**
- pageRank: page rank algorithm for nodes ranking
- degree: calculate the in degree, out degree, and total degree for nodes

- **Path**
- dijkstra: Dijkstra shortest path algorithm
- findPath: Find the shortest paths and all paths for two nodes by Dijkstra
- floydWarshall: Floyd Warshall shortest path algorithm

- **Other**
- neighbors: Find the neighbors for a node in the graph
- GADDI: graph structural and semantic pattern matching algorithm
- detectCycle: Detect the cycles of the graph data
- dfs: Depth-First search algorithm
- adjacentMatrix: calculate the adjacency matrix for graph data
- connectedComponent: Calculate the connected components for graph data

All the algorithms above supports to be calculated with web-worker.

## Development

We use [Vite](https://vitejs.dev/) to start a dev server:

```bash
$ pnpm dev
```

## Test

Run all the test cases with Jest:

```bash
$ pnpm test
```

## Publish

Using Changesets with pnpm: https://pnpm.io/next/using-changesets

The generated markdown files in the .changeset directory should be committed to the repository.

```bash
pnpm changeset
```

This will bump the versions of the packages previously specified with pnpm changeset (and any dependents of those) and update the changelog files.

```bash
pnpm changeset version
```

Commit the changes. This command will publish all packages that have bumped versions not yet present in the registry.

```bash
pnpm publish -r
```

If you want to publish versions for test:

```bash
pnpm changeset pre enter alpha
pnpm changeset pre enter beta
pnpm changeset pre enter rc
```
Loading