https://github.com/italocobains/graph
Is a lib wirte in c++ and nodejs to manipulate graph more fast.
https://github.com/italocobains/graph
addon cp graph-algorithms nodejs
Last synced: 27 days ago
JSON representation
Is a lib wirte in c++ and nodejs to manipulate graph more fast.
- Host: GitHub
- URL: https://github.com/italocobains/graph
- Owner: ItaloCobains
- Created: 2023-11-13T14:12:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-09T05:28:09.000Z (over 2 years ago)
- Last Synced: 2025-01-21T17:23:08.921Z (over 1 year ago)
- Topics: addon, cp, graph-algorithms, nodejs
- Language: C++
- Homepage: https://www.npmjs.com/package/@italocobains/graph
- Size: 214 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Graph
Is a lib wirte in c++ and nodejs to manipulate graph more fast.
## Install
```bash
npm i @italocobains/graph
```
## Use
```js
const Graph = require("@italocobains/graph");
const graph = new Graph();
graph.addNode(1);
graph.addNode(2);
graph.addEdge(1, 2);
console.log(graph.toString());
graph.removeNode(1);
console.log(graph.toString());
const nodes = graph.getNodes();
console.log(nodes);
console.log(graph.hasNode(2));
console.log(graph.hasEdge(1, 2));
console.log(graph.getNeighbors(2));
console.log(graph.getInNeighbors(2));
console.log(graph.getOutNeighbors(2));
console.log(graph.getEdge(1, 2));
console.log(graph.getDegree(2));
console.log(graph.getInDegree(2));
console.log(graph.getOutDegree(2));
console.log(graph.isEmpty());
console.log(graph.getNumNodes());
console.log(graph.getNumEdges());
graph.clear();
```