UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 351 B
import p from"ngraph.graph";import{toNodeId as c}from"./graphHelpers";import{linkCost as a}from"./linkCost";export function buildNGraph(e,d){const{oriented:s,onlyAccessible:f}=d,n=p();for(const o of e){if(f&&o.unaccessible)continue;const t=c(o.p0),i=c(o.p1),r=a(o);n.addLink(t,i,{distance:r}),s&&!o.unidirection&&n.addLink(i,t,{distance:r})}return n}