UNPKG

react-planner

Version:

react-planner is a React Component for plans design. Draw a 2D floorplan and navigate it in 3D mode.

32 lines (27 loc) 847 B
"use strict"; function getEdgesOfSubgraphs(subgraphs, graph) { var edges = []; subgraphs.forEach(function (component) { edges.push([]); var vertices = getVerticesFromBiconnectedComponent(component); var inserted = []; vertices.forEach(function (vertex) { var adjacents = graph.adj[vertex]; adjacents.forEach(function (adj) { if (vertex <= adj && vertices.has(adj)) { edges[edges.length - 1].push([vertex, adj]); } }); }); }); return edges; } function getVerticesFromBiconnectedComponent(component) { var vertices = new Set(); component.forEach(function (edge) { vertices.add(edge.u); vertices.add(edge.v); }); return vertices; } module.exports = getEdgesOfSubgraphs;