Graphs and Paths
Tools for graphs representing 2-D spatial points and links between them.
Demo
Installation
With Yarn:
yarn add graphs-and-paths
With NPM:
npm install --save graphs-and-paths
API
Sample Usage
;const nodes =id: "A" location: x: 0 y: 0id: "B" location: x: 3 y: 0id: "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;graph;// { id: "A", location: { x: 0, y: 0 }, edgeIds: ["AB", "CA"] }graph;// { x: 2, y: 0 }graphlocations;// [// { 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