From 2e302b90138115e2045679edb023eea0c659df12 Mon Sep 17 00:00:00 2001 From: Oleg Sh <> Date: Thu, 28 Mar 2024 21:49:04 +0100 Subject: [PATCH] Turn on negative edge weight support --- script/entities/edge/model/BaseEdge.js | 2 +- script/entities/graph/model/Graph.js | 32 ++++++++++++++++--- .../features/algorithms/model/Algorithms.js | 6 ++++ .../features/algorithms/model/plugins/BFS.js | 5 +++ .../algorithms/model/plugins/Coloring.js | 4 +++ .../model/plugins/ConnectedComponent.js | 5 +++ .../features/algorithms/model/plugins/DFS.js | 5 +++ .../algorithms/model/plugins/EulerianLoop.js | 5 +++ .../algorithms/model/plugins/EulerianPath.js | 5 +++ .../model/plugins/FindAllPatches.js | 4 +++ .../algorithms/model/plugins/GraphReorder.js | 5 +++ .../model/plugins/HamiltonianLoop.js | 5 +++ .../model/plugins/HamiltonianPath.js | 5 +++ .../model/plugins/IsomorphismCheck.js | 5 +++ .../algorithms/model/plugins/MaxClique.js | 5 +++ .../model/plugins/ModernGraphStyle.js | 5 +++ .../model/plugins/RadiusAndDiameter.js | 5 +++ .../model/plugins/VerticesDegree.js | 5 +++ .../create_graph_by_matrix/api/index.js.cache | 22 ++++++++----- script/pages/editor/api/index.js.cache | 31 +++++++++++------- script/pages/editor/ui/editor.js | 7 +++- 21 files changed, 148 insertions(+), 25 deletions(-) diff --git a/script/entities/edge/model/BaseEdge.js b/script/entities/edge/model/BaseEdge.js index 9e890e7..ced24b9 100644 --- a/script/entities/edge/model/BaseEdge.js +++ b/script/entities/edge/model/BaseEdge.js @@ -256,7 +256,7 @@ BaseEdge.prototype.SetWeight = function(weight) { useWeight = true; } - weight = (!isNaN(parseInt(weight, 10)) && weight >= 0) ? weight : 1; + weight = (!isNaN(parseInt(weight, 10))/*&& weight >= 0*/) ? weight : 1; this.weight = Number(weight); this.useWeight = useWeight; diff --git a/script/entities/graph/model/Graph.js b/script/entities/graph/model/Graph.js index 5d93d72..9f9163c 100644 --- a/script/entities/graph/model/Graph.js +++ b/script/entities/graph/model/Graph.js @@ -18,6 +18,8 @@ function Graph() this.hasDirect = false; // Is graph multi this.isMultiGraph = false; + // Has negative weight + this.hasNegativeWeight = false; }; // infinity @@ -51,6 +53,7 @@ Graph.prototype.ClearGraph = function() { this.hasDirect = false; // Is graph multi this.isMultiGraph = false; + this.hasNegativeWeight = false; } Graph.prototype.AddNewEdgeSafe = function(graph1, graph2, isDirect, weight, replaceIfExists = true) @@ -85,6 +88,7 @@ Graph.prototype.AddNewEdge = function(edge, replaceIfExists) } this.isMultiGraph = this.checkMutiGraph(); + this.hasNegativeWeight = this.checkNegativeWeight(); return this.edges.length - 1; } @@ -99,6 +103,7 @@ Graph.prototype.DeleteEdge = function(edgeObject) } this.isMultiGraph = this.checkMutiGraph(); + this.hasNegativeWeight = this.checkNegativeWeight(); } Graph.prototype.DeleteVertex = function(vertexObject) @@ -669,7 +674,7 @@ Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnum this.AddNewVertex(newVertices[newVertices.length - 1]); } - if (cols[i][j] > 0) + if (cols[i][j] != 0) { var nEdgeIndex = this.AddNewEdgeSafe(this.vertices[i], this.vertices[j], cols[i][j] != cols[j][i], cols[i][j], true); this.FixEdgeCurve(nEdgeIndex); @@ -717,9 +722,9 @@ Graph.prototype.SetPair = function (pairs, viewportSize, currentEnumVerticesType /^(.+)-(.+)$/g, /^(.+)\>(.+)$/g, /^(.+)<(.+)$/g, - /^(.+)-\((\d+|\d+\.?\d+)\)-(.+)$/g, - /^(.+)-\((\d+|\d+\.?\d+)\)\>(.+)$/g, - /^(.+)<\((\d+|\d+\.?\d+)\)\-(.+)$/g, + /^(.+)-\((-?\d+|-?\d+\.?\d+)\)-(.+)$/g, + /^(.+)-\((-?\d+|-?\d+\.?\d+)\)\>(.+)$/g, + /^(.+)<\((-?\d+|-?\d+\.?\d+)\)\-(.+)$/g, ]; let bWeightGraph = false; @@ -1122,6 +1127,7 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData) } this.isMultiGraph = this.checkMutiGraph(); + this.hasNegativeWeight = this.checkNegativeWeight(); } Graph.prototype.hasDirectEdge = function () @@ -1276,11 +1282,29 @@ Graph.prototype.checkMutiGraph = function () return res; } +Graph.prototype.checkNegativeWeight = function () +{ + var res = false; + + for (var i = 0; i < this.edges.length && !res; i++) + { + var edge = this.edges[i]; + res = edge.GetWeight() < 0; + } + + return res; +} + Graph.prototype.isMulti = function () { return this.isMultiGraph; } +Graph.prototype.hasNegative = function () +{ + return this.hasNegativeWeight; +} + Graph.prototype.isNeedReposition = function () { var res = false; diff --git a/script/features/algorithms/model/Algorithms.js b/script/features/algorithms/model/Algorithms.js index b4d3a43..90daa7e 100644 --- a/script/features/algorithms/model/Algorithms.js +++ b/script/features/algorithms/model/Algorithms.js @@ -146,6 +146,12 @@ BaseAlgorithm.prototype.getCategory = function() return 0; } +// Algorithm support negative edge weight +BaseAlgorithm.prototype.IsSupportNegativeWeight = function() +{ + return false; +} + /** * Default handler. * Select using mouse, drag. diff --git a/script/features/algorithms/model/plugins/BFS.js b/script/features/algorithms/model/plugins/BFS.js index e1b2379..81a32f8 100644 --- a/script/features/algorithms/model/plugins/BFS.js +++ b/script/features/algorithms/model/plugins/BFS.js @@ -115,6 +115,11 @@ BFSAlgorithm.prototype.IsSupportMultiGraph = function() return true; } +BFSAlgorithm.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateBFSAlgorithm(graph, app) { diff --git a/script/features/algorithms/model/plugins/Coloring.js b/script/features/algorithms/model/plugins/Coloring.js index 18a1794..148a842 100644 --- a/script/features/algorithms/model/plugins/Coloring.js +++ b/script/features/algorithms/model/plugins/Coloring.js @@ -375,6 +375,10 @@ Coloring.prototype.IsSupportMultiGraph = function() return true; } +Coloring.prototype.IsSupportNegativeWeight = function() +{ + return true; +} // Factory for connected components. function CreateColoring(graph, app) diff --git a/script/features/algorithms/model/plugins/ConnectedComponent.js b/script/features/algorithms/model/plugins/ConnectedComponent.js index 95a598a..ae476d7 100644 --- a/script/features/algorithms/model/plugins/ConnectedComponent.js +++ b/script/features/algorithms/model/plugins/ConnectedComponent.js @@ -119,6 +119,11 @@ FindConnectedComponentNew.prototype.IsSupportMultiGraph = function() return true; } +FindConnectedComponentNew.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateConnectedComponetsNew(graph, app) diff --git a/script/features/algorithms/model/plugins/DFS.js b/script/features/algorithms/model/plugins/DFS.js index 1767011..f2992a5 100644 --- a/script/features/algorithms/model/plugins/DFS.js +++ b/script/features/algorithms/model/plugins/DFS.js @@ -114,6 +114,11 @@ DFSAlgorithm.prototype.IsSupportMultiGraph = function() return true; } +DFSAlgorithm.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateDFSAlgorithm(graph, app) { diff --git a/script/features/algorithms/model/plugins/EulerianLoop.js b/script/features/algorithms/model/plugins/EulerianLoop.js index 137d5a2..9bfed35 100644 --- a/script/features/algorithms/model/plugins/EulerianLoop.js +++ b/script/features/algorithms/model/plugins/EulerianLoop.js @@ -87,6 +87,11 @@ FindEulerianLoop.prototype.getPriority = function() return -7.5; } +FindEulerianLoop.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindEulerianLoop(graph, app) { diff --git a/script/features/algorithms/model/plugins/EulerianPath.js b/script/features/algorithms/model/plugins/EulerianPath.js index 1d733ab..a6b81ae 100644 --- a/script/features/algorithms/model/plugins/EulerianPath.js +++ b/script/features/algorithms/model/plugins/EulerianPath.js @@ -87,6 +87,11 @@ FindEulerianPath.prototype.getPriority = function() return -7.5; } +FindEulerianPath.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindEulerianPath(graph, app) { diff --git a/script/features/algorithms/model/plugins/FindAllPatches.js b/script/features/algorithms/model/plugins/FindAllPatches.js index 60852a3..d26862e 100644 --- a/script/features/algorithms/model/plugins/FindAllPatches.js +++ b/script/features/algorithms/model/plugins/FindAllPatches.js @@ -221,6 +221,10 @@ FindAllPathes.prototype.getPriority = function() return -9.4; } +FindAllPathes.prototype.IsSupportNegativeWeight = function() +{ + return true; +} // Factory for connected components. function CreateFindAllPathes(graph, app) diff --git a/script/features/algorithms/model/plugins/GraphReorder.js b/script/features/algorithms/model/plugins/GraphReorder.js index 721383d..d5ba257 100644 --- a/script/features/algorithms/model/plugins/GraphReorder.js +++ b/script/features/algorithms/model/plugins/GraphReorder.js @@ -165,6 +165,11 @@ GraphReorder.prototype.IsSupportMultiGraph = function() return true; } +GraphReorder.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateAlgorithmGraphReorder(graph, app) { diff --git a/script/features/algorithms/model/plugins/HamiltonianLoop.js b/script/features/algorithms/model/plugins/HamiltonianLoop.js index 390d5b3..4d58f39 100644 --- a/script/features/algorithms/model/plugins/HamiltonianLoop.js +++ b/script/features/algorithms/model/plugins/HamiltonianLoop.js @@ -104,6 +104,11 @@ FindHamiltonianLoop.prototype.IsSupportMultiGraph = function() return true; } +FindHamiltonianLoop.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindHamiltonianLoop(graph, app) { diff --git a/script/features/algorithms/model/plugins/HamiltonianPath.js b/script/features/algorithms/model/plugins/HamiltonianPath.js index 7a4c373..5c29bef 100644 --- a/script/features/algorithms/model/plugins/HamiltonianPath.js +++ b/script/features/algorithms/model/plugins/HamiltonianPath.js @@ -102,6 +102,11 @@ FindHamiltonianPath.prototype.IsSupportMultiGraph = function() return true; } +FindHamiltonianPath.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindHamiltonianPath(graph, app) { diff --git a/script/features/algorithms/model/plugins/IsomorphismCheck.js b/script/features/algorithms/model/plugins/IsomorphismCheck.js index 781fdf0..992c29b 100644 --- a/script/features/algorithms/model/plugins/IsomorphismCheck.js +++ b/script/features/algorithms/model/plugins/IsomorphismCheck.js @@ -289,6 +289,11 @@ IsomorphismCheck.prototype.messageWasChanged = function() } } +IsomorphismCheck.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateIsomorphismCheck(graph, app) { diff --git a/script/features/algorithms/model/plugins/MaxClique.js b/script/features/algorithms/model/plugins/MaxClique.js index f462e36..21b4389 100644 --- a/script/features/algorithms/model/plugins/MaxClique.js +++ b/script/features/algorithms/model/plugins/MaxClique.js @@ -91,6 +91,11 @@ MaxClique.prototype.getPriority = function() return -5; } +MaxClique.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + function CreateMaxClique(graph, app) { return new MaxClique(graph, app) diff --git a/script/features/algorithms/model/plugins/ModernGraphStyle.js b/script/features/algorithms/model/plugins/ModernGraphStyle.js index 8fa1081..12aed37 100644 --- a/script/features/algorithms/model/plugins/ModernGraphStyle.js +++ b/script/features/algorithms/model/plugins/ModernGraphStyle.js @@ -188,6 +188,11 @@ ModernGraphStyle.prototype.IsSupportMultiGraph = function() return true; } +ModernGraphStyle.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateAlgorithmModernGraphStyle(graph, app) { diff --git a/script/features/algorithms/model/plugins/RadiusAndDiameter.js b/script/features/algorithms/model/plugins/RadiusAndDiameter.js index d3af88b..865a340 100644 --- a/script/features/algorithms/model/plugins/RadiusAndDiameter.js +++ b/script/features/algorithms/model/plugins/RadiusAndDiameter.js @@ -221,6 +221,11 @@ RadiusAndDiameter.prototype.IsSupportMultiGraph = function () return true; } +RadiusAndDiameter.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateAlgorithmRadiusAndDiameter(graph, app) { diff --git a/script/features/algorithms/model/plugins/VerticesDegree.js b/script/features/algorithms/model/plugins/VerticesDegree.js index 3da6d6d..5f1d000 100644 --- a/script/features/algorithms/model/plugins/VerticesDegree.js +++ b/script/features/algorithms/model/plugins/VerticesDegree.js @@ -92,6 +92,11 @@ VerticesDegree.prototype.IsSupportMultiGraph = function () return true; } +VerticesDegree.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateAlgorithmVerticesDegree(graph, app) { diff --git a/script/pages/create_graph_by_matrix/api/index.js.cache b/script/pages/create_graph_by_matrix/api/index.js.cache index 1f4be50..2e3a8c4 100644 --- a/script/pages/create_graph_by_matrix/api/index.js.cache +++ b/script/pages/create_graph_by_matrix/api/index.js.cache @@ -88,7 +88,7 @@ else BaseEdge.prototype.SetWeight=function(weight) {var useWeight=false;if(!isNaN(parseInt(weight,10))) {useWeight=true;} -weight=(!isNaN(parseInt(weight,10))&&weight>=0)?weight:1;this.weight=Number(weight);this.useWeight=useWeight;} +weight=(!isNaN(parseInt(weight,10)))?weight:1;this.weight=Number(weight);this.useWeight=useWeight;} BaseEdge.prototype.SetUpText=function(text) {this.upText=text;} BaseEdge.prototype.resetOwnStyle=function(index) @@ -216,11 +216,11 @@ BaseVertex.prototype.hasOwnStyleFor=function(index) const defaultVertexDiameter=30;function VertexModel() {this.diameter=globalApplication.GetDefaultVertexSize();} function Graph() -{this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;};Graph.prototype.infinity=1E8;Graph.prototype.maxVertices=1000;Graph.prototype.edgesOffset=10000;Graph.prototype.AddNewVertex=function(vertex) +{this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;this.hasNegativeWeight=false;};Graph.prototype.infinity=1E8;Graph.prototype.maxVertices=1000;Graph.prototype.edgesOffset=10000;Graph.prototype.AddNewVertex=function(vertex) {if(this.vertices.length<=this.maxVertices) {vertex.SetId(this.uidGraph);this.uidGraph=this.uidGraph+1;this.vertices.push(vertex);} return this.vertices.length-1;} -Graph.prototype.ClearGraph=function(){this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;} +Graph.prototype.ClearGraph=function(){this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;this.hasNegativeWeight=false;} Graph.prototype.AddNewEdgeSafe=function(graph1,graph2,isDirect,weight,replaceIfExists=true) {return this.AddNewEdge(new BaseEdge(graph1,graph2,isDirect,weight),replaceIfExists);} Graph.prototype.AddNewEdge=function(edge,replaceIfExists) @@ -232,11 +232,11 @@ else {if(edge1!=null&&replaceIfExists) this.DeleteEdge(edge1);if(edgeRevert!=null&&!edgeRevert.isDirect&&replaceIfExists) this.DeleteEdge(edgeRevert);this.edges.push(edge);} -this.isMultiGraph=this.checkMutiGraph();return this.edges.length-1;} +this.isMultiGraph=this.checkMutiGraph();this.hasNegativeWeight=this.checkNegativeWeight();return this.edges.length-1;} Graph.prototype.DeleteEdge=function(edgeObject) {var index=this.edges.indexOf(edgeObject);if(index>-1) {this.edges.splice(index,1);} -this.isMultiGraph=this.checkMutiGraph();} +this.isMultiGraph=this.checkMutiGraph();this.hasNegativeWeight=this.checkNegativeWeight();} Graph.prototype.DeleteVertex=function(vertexObject) {var index=this.vertices.indexOf(vertexObject);if(index>-1) {for(var i=0;i=this.vertices.length) {var newPos=this.GetRandomPositionOfVertex(matrix,j,viewportSize);newVertices.push(new BaseVertex(newPos.x,newPos.y,currentEnumVerticesType));this.AddNewVertex(newVertices[newVertices.length-1]);} -if(cols[i][j]>0) +if(cols[i][j]!=0) {var nEdgeIndex=this.AddNewEdgeSafe(this.vertices[i],this.vertices[j],cols[i][j]!=cols[j][i],cols[i][j],true);this.FixEdgeCurve(nEdgeIndex);if(nEdgeIndex>=0) {bWeightGraph=bWeightGraph||this.edges[nEdgeIndex].weight!=1;}}}} if(!bWeightGraph) @@ -402,7 +402,7 @@ for(var i=rows.length;i(.+)$/g,/^(.+)<(.+)$/g,/^(.+)-\((\d+|\d+\.?\d+)\)-(.+)$/g,/^(.+)-\((\d+|\d+\.?\d+)\)\>(.+)$/g,/^(.+)<\((\d+|\d+\.?\d+)\)\-(.+)$/g,];let bWeightGraph=false;var newVertices=[];for(var i=0;i(.+)$/g,/^(.+)<(.+)$/g,/^(.+)-\((-?\d+|-?\d+\.?\d+)\)-(.+)$/g,/^(.+)-\((-?\d+|-?\d+\.?\d+)\)\>(.+)$/g,/^(.+)<\((-?\d+|-?\d+\.?\d+)\)\-(.+)$/g,];let bWeightGraph=false;var newVertices=[];for(var i=0;i=0;--j){if(!line.match(regExp[j])){continue;} let groupes=Array.from(line.matchAll(regExp[j]));let groupe=groupes[0];let vetext1Title=groupe[1];let vertex1=this.FindVertexByTitle(vetext1Title);if(vertex1==null){let newPosition=this.GetRandomPosition(viewportSize);vertex1=this.vertices[this.AddNewVertex(new BaseVertex(newPosition.x,newPosition.y,currentEnumVerticesType))];vertex1.mainText=vetext1Title;newVertices.push(vertex1);} @@ -509,7 +509,7 @@ Graph.prototype.LoadFromXML=function(xmlText,additionalData) this.uidGraph=loadedGraphId;this.uidEdge=loadedEdgeId;$nodes=$xml.find("node");var vertices=[];$nodes.each(function(){var vertex=new BaseVertex();vertex.LoadFromXML($(this));vertices.push(vertex);});this.vertices=vertices;$edges=$xml.find("edge");var edges=[];var graph=this;$edges.each(function(){var edge=new BaseEdge();edge.LoadFromXML($(this),graph);if(edge.id=0)?weight:1;this.weight=Number(weight);this.useWeight=useWeight;} +weight=(!isNaN(parseInt(weight,10)))?weight:1;this.weight=Number(weight);this.useWeight=useWeight;} BaseEdge.prototype.SetUpText=function(text) {this.upText=text;} BaseEdge.prototype.resetOwnStyle=function(index) @@ -229,11 +229,11 @@ BaseVertex.prototype.hasOwnStyleFor=function(index) const defaultVertexDiameter=30;function VertexModel() {this.diameter=globalApplication.GetDefaultVertexSize();} function Graph() -{this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;};Graph.prototype.infinity=1E8;Graph.prototype.maxVertices=1000;Graph.prototype.edgesOffset=10000;Graph.prototype.AddNewVertex=function(vertex) +{this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;this.hasNegativeWeight=false;};Graph.prototype.infinity=1E8;Graph.prototype.maxVertices=1000;Graph.prototype.edgesOffset=10000;Graph.prototype.AddNewVertex=function(vertex) {if(this.vertices.length<=this.maxVertices) {vertex.SetId(this.uidGraph);this.uidGraph=this.uidGraph+1;this.vertices.push(vertex);} return this.vertices.length-1;} -Graph.prototype.ClearGraph=function(){this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;} +Graph.prototype.ClearGraph=function(){this.vertices=[];this.edges=[];this.uidGraph=0;this.uidEdge=10000;this.hasDirect=false;this.isMultiGraph=false;this.hasNegativeWeight=false;} Graph.prototype.AddNewEdgeSafe=function(graph1,graph2,isDirect,weight,replaceIfExists=true) {return this.AddNewEdge(new BaseEdge(graph1,graph2,isDirect,weight),replaceIfExists);} Graph.prototype.AddNewEdge=function(edge,replaceIfExists) @@ -245,11 +245,11 @@ else {if(edge1!=null&&replaceIfExists) this.DeleteEdge(edge1);if(edgeRevert!=null&&!edgeRevert.isDirect&&replaceIfExists) this.DeleteEdge(edgeRevert);this.edges.push(edge);} -this.isMultiGraph=this.checkMutiGraph();return this.edges.length-1;} +this.isMultiGraph=this.checkMutiGraph();this.hasNegativeWeight=this.checkNegativeWeight();return this.edges.length-1;} Graph.prototype.DeleteEdge=function(edgeObject) {var index=this.edges.indexOf(edgeObject);if(index>-1) {this.edges.splice(index,1);} -this.isMultiGraph=this.checkMutiGraph();} +this.isMultiGraph=this.checkMutiGraph();this.hasNegativeWeight=this.checkNegativeWeight();} Graph.prototype.DeleteVertex=function(vertexObject) {var index=this.vertices.indexOf(vertexObject);if(index>-1) {for(var i=0;i=this.vertices.length) {var newPos=this.GetRandomPositionOfVertex(matrix,j,viewportSize);newVertices.push(new BaseVertex(newPos.x,newPos.y,currentEnumVerticesType));this.AddNewVertex(newVertices[newVertices.length-1]);} -if(cols[i][j]>0) +if(cols[i][j]!=0) {var nEdgeIndex=this.AddNewEdgeSafe(this.vertices[i],this.vertices[j],cols[i][j]!=cols[j][i],cols[i][j],true);this.FixEdgeCurve(nEdgeIndex);if(nEdgeIndex>=0) {bWeightGraph=bWeightGraph||this.edges[nEdgeIndex].weight!=1;}}}} if(!bWeightGraph) @@ -415,7 +415,7 @@ for(var i=rows.length;i(.+)$/g,/^(.+)<(.+)$/g,/^(.+)-\((\d+|\d+\.?\d+)\)-(.+)$/g,/^(.+)-\((\d+|\d+\.?\d+)\)\>(.+)$/g,/^(.+)<\((\d+|\d+\.?\d+)\)\-(.+)$/g,];let bWeightGraph=false;var newVertices=[];for(var i=0;i(.+)$/g,/^(.+)<(.+)$/g,/^(.+)-\((-?\d+|-?\d+\.?\d+)\)-(.+)$/g,/^(.+)-\((-?\d+|-?\d+\.?\d+)\)\>(.+)$/g,/^(.+)<\((-?\d+|-?\d+\.?\d+)\)\-(.+)$/g,];let bWeightGraph=false;var newVertices=[];for(var i=0;i=0;--j){if(!line.match(regExp[j])){continue;} let groupes=Array.from(line.matchAll(regExp[j]));let groupe=groupes[0];let vetext1Title=groupe[1];let vertex1=this.FindVertexByTitle(vetext1Title);if(vertex1==null){let newPosition=this.GetRandomPosition(viewportSize);vertex1=this.vertices[this.AddNewVertex(new BaseVertex(newPosition.x,newPosition.y,currentEnumVerticesType))];vertex1.mainText=vetext1Title;newVertices.push(vertex1);} @@ -522,7 +522,7 @@ Graph.prototype.LoadFromXML=function(xmlText,additionalData) this.uidGraph=loadedGraphId;this.uidEdge=loadedEdgeId;$nodes=$xml.find("node");var vertices=[];$nodes.each(function(){var vertex=new BaseVertex();vertex.LoadFromXML($(this));vertices.push(vertex);});this.vertices=vertices;$edges=$xml.find("edge");var edges=[];var graph=this;$edges.each(function(){var edge=new BaseEdge();edge.LoadFromXML($(this),graph);if(edge.id