Skip to content

Commit

Permalink
1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ItaloCobains committed Nov 14, 2023
1 parent 0ff1cd7 commit 49bef01
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,46 @@ npm i @italocobains/graph
```js
const Graph = require("@italocobains/graph");


const graph = new Graph();
graph.addNode(1);
graph.addNode(2);
graph.addEdge(1, 2);

console.log("Has node 1:", graph.hasNode(1));
console.log("Has edge 1 -> 2:", graph.hasEdge(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();

```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@italocobains/graph",
"version": "1.0.8",
"version": "1.1.8",
"description": "This is a lib write by c++ and nodejs addon api for graph algorithm.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 49bef01

Please sign in to comment.