Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
graphs-and-paths
Advanced tools
Tools for graphs representing 2-D spatial points and links between them.
Tools for graphs representing 2-D spatial points and links between them.
With Yarn:
yarn add graphs-and-paths
With NPM:
npm install --save graphs-and-paths
import Graph from "graphs-and-paths";
const nodes = [
{ id: "A", location: { x: 0, y: 0 } },
{ id: "B", location: { x: 3, y: 0 } },
{ id: "C", location: { x: 0, y: 4 } }
];
const edges = [
{ id: "AB", startNodeId: "A", endNodeId: "B" },
{ id: "BC", startNodeId: "B", endNodeId: "C" },
{ id: "CA", startNodeId: "C", endNodeId: "A" }
];
const graph = Graph.create(nodes, edges);
graph.getNode("A");
// { id: "A", location: { x: 0, y: 0 }, edgeIds: ["AB", "CA"] }
graph.getLocation("AB", 2);
// { x: 2, y: 0 }
graph.getShortestPath(
{ edgeId: "CA", distance: 3 },
{ edgeId: "BC", distance: 1 }
).locations;
// [
// { x: 0, y: 1 },
// { x: 0, y: 0 },
// { x: 3, y: 0 },
// { x: 2.4, y: 0.8 }
// ]
Many more methods are available. View full documentation for details.
Copyright © 2016 David Philipson
FAQs
Tools for graphs representing 2-D spatial points and links between them.
The npm package graphs-and-paths receives a total of 0 weekly downloads. As such, graphs-and-paths popularity was classified as not popular.
We found that graphs-and-paths demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.