Modules@robinpath/graph

@robinpath/graph

0.1.0Public

Graph data structures with BFS, DFS, Dijkstra's shortest path, topological sort, cycle detection, and connectivity

@robinpath/graph

Graph data structures with BFS, DFS, Dijkstra's shortest path, topological sort, cycle detection, and connectivity

Category Functions Auth License

Why use this module?

The graph module lets you:

  • Create graph
  • Add node
  • Add edge
  • Remove node and its edges
  • Remove edge

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/graph

Quick Start

No credentials needed — start using it right away:

graph.addNode "A" {"label": "Start"}

Available Functions

FunctionDescription
graph.createCreate graph
graph.addNodeAdd node
graph.addEdgeAdd edge
graph.removeNodeRemove node and its edges
graph.removeEdgeRemove edge
graph.nodesList all nodes
graph.edgesList all edges
graph.neighborsGet node neighbors
graph.degreeGet node degree
graph.bfsBreadth-first search
graph.dfsDepth-first search
graph.shortestPathDijkstra's shortest path
graph.topologicalSortTopological sort (DAG only)
graph.hasCycleCheck for cycles
graph.isConnectedCheck if graph is connected
graph.hasPathCheck if path exists between nodes
graph.sizeGet graph size
graph.destroyDestroy graph
graph.listList all graphs

Examples

Add node

graph.addNode "A" {"label": "Start"}

Add edge

graph.addEdge "A" "B" 5

Remove node and its edges

graph.removeNode "A"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/graph";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  graph.addNode "A" {"label": "Start"}
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/graph
Version0.1.0
LicenseMIT
Unpacked Size5.9 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

data