MCPcopy Index your code
hub / github.com/avoidwork/tiny-graph

github.com/avoidwork/tiny-graph @2.1.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.1.3 ↗ · + Follow
51 symbols 91 edges 7 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

tiny-graph

build status

Tiny graph data structure for Client or Server

Example

const graph = require('tiny-graph'),
    g = graph();

g.setNodeValue('f', 3);
g.setNodeValue('h', 21);
g.add('f', 'h');
g.setEdgeValue('f', 'h', 100);

console.log(g.adjacent('f', 'h')); // true
console.log(g.neighbors('f')); // ['h']
console.log(g.getEdgeValue('f', 'h')); // 100

How can I use tiny-graph?

tiny-graph can be installed from npm & bower, and supports AMD loaders or script tags (window.graph).

API

add(x, y)

Adds the edge from x to y, if it is not there

adjacent(x, y)

Tests whether there is an edge from node x to node y

del(x, y)

Removes the edge from x to y, if it is there

delNode(x)

Removes node x from the graph, if it is there

fromJSON(arg)

Deserializes arg as the graph

getEdgeValue(x, y)

Returns the value associated to the edge (x, y)

getNodeValue(x)

Returns the value associated with the node x

neighbors(x)

Lists all nodes y such that there is an edge from x to y

setEdgeValue(x, y, v)

Sets the value associated to the edge (x, y) to v

setNodeValue(x, v)

Sets the value associated with the node x to v

toJSON()

Serializes the graph as JSON

License

Copyright (c) 2018 Jason Mulligan Licensed under the BSD-3 license

Core symbols most depended-on inside this repo

defined
called by 15
lib/tiny-graph.js
defined
called by 15
src/intro.js
getEdgeValue
called by 7
src/graph.js
getNodeValue
called by 6
src/graph.js
adjacent
called by 5
src/graph.js
setNodeValue
called by 5
src/graph.js
neighbors
called by 4
src/graph.js
add
called by 2
src/graph.js

Shape

Method 36
Function 9
Class 6

Languages

TypeScript100%

Modules by API surface

lib/tiny-graph.min.js17 symbols
lib/tiny-graph.js17 symbols
src/graph.js14 symbols
src/intro.js2 symbols
src/outro.js1 symbols

For agents

$ claude mcp add tiny-graph \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact