- Notifications
You must be signed in to change notification settings - Fork1
Tools for graphs representing 2-D spatial points and links between them.
License
NotificationsYou must be signed in to change notification settings
dphilipson/graphs-and-paths
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Tools for graphs representing 2-D spatial points and links between them.
With Yarn:
yarn add graphs-and-pathsWith NPM:
npm install --save graphs-and-pathsimportGraphfrom"graphs-and-paths";constnodes=[{id:"A",location:{x:0,y:0}},{id:"B",location:{x:3,y:0}},{id:"C",location:{x:0,y:4}}];constedges=[{id:"AB",startNodeId:"A",endNodeId:"B"},{id:"BC",startNodeId:"B",endNodeId:"C"},{id:"CA",startNodeId:"C",endNodeId:"A"}];constgraph=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 fulldocumentation for details.
Copyright © 2016 David Philipson
About
Tools for graphs representing 2-D spatial points and links between them.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.