diff --git a/HISTORY.md b/HISTORY.md index 2db774a5..6b2edf0f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,10 @@ http://visjs.org ## NOT YET RELEASED, version 4.8.3 +### Network + +- Fixed bug where an edge that was not connected would crash the layout algorithms. + ## 2015-09-14, version 4.8.2 ### Network diff --git a/dist/vis.js b/dist/vis.js index 23267576..9a0648c1 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 4.8.2 - * @date 2015-09-14 + * @version 4.8.3-SNAPSHOT + * @date 2015-09-17 * * @license * Copyright (C) 2011-2015 Almende B.V, http://almende.com @@ -41787,8 +41787,11 @@ return /******/ (function(modules) { // webpackBootstrap // put the weights for the edges in. This assumes unidirectionality. for (var i = 0; i < edgesArray.length; i++) { var edge = edges[edgesArray[i]]; - D_matrix[edge.fromId][edge.toId] = 1; - D_matrix[edge.toId][edge.fromId] = 1; + if (edge.connected === true) { + // edge has to be connected if it counts to the distances. + D_matrix[edge.fromId][edge.toId] = 1; + D_matrix[edge.toId][edge.fromId] = 1; + } } var nodeCount = nodesArray.length; diff --git a/lib/network/modules/components/algorithms/FloydWarshall.js b/lib/network/modules/components/algorithms/FloydWarshall.js index a41b7c79..b3851d65 100644 --- a/lib/network/modules/components/algorithms/FloydWarshall.js +++ b/lib/network/modules/components/algorithms/FloydWarshall.js @@ -23,8 +23,10 @@ class FloydWarshall { // put the weights for the edges in. This assumes unidirectionality. for (let i = 0; i < edgesArray.length; i++) { let edge = edges[edgesArray[i]]; - D_matrix[edge.fromId][edge.toId] = 1; - D_matrix[edge.toId][edge.fromId] = 1; + if (edge.connected === true) { // edge has to be connected if it counts to the distances. + D_matrix[edge.fromId][edge.toId] = 1; + D_matrix[edge.toId][edge.fromId] = 1; + } } let nodeCount = nodesArray.length;