Fix search loop and path in non multi graph.

This commit is contained in:
Unick Soft 2020-05-03 21:17:49 +02:00
parent bbcdbb7294
commit 14cefec5c1

View File

@ -55,20 +55,29 @@ FindHamiltonianLoop.prototype.resultCallback = function(pathObjects, properties,
var nodesEdgesPath = this.GetNodesEdgesPath(results, 1, results.length - 1); var nodesEdgesPath = this.GetNodesEdgesPath(results, 1, results.length - 1);
var nodesPath = this.GetNodesPath(results, 1, results.length - 1); var nodesPath = this.GetNodesPath(results, 1, results.length - 1);
this.message = this.message + ": ";
if (this.graph.isMulti())
{
outputResult["pathsWithEdges"] = []; outputResult["pathsWithEdges"] = [];
outputResult["pathsWithEdges"].push(nodesEdgesPath); outputResult["pathsWithEdges"].push(nodesEdgesPath);
}
else
{
outputResult["paths"] = [];
outputResult["paths"].push(nodesEdgesPath);
}
for (var i = 0; i < nodesPath.length; i++)
{
this.message = this.message + this.graph.FindVertex(nodesPath[i]).mainText + ((i < nodesPath.length - 1) ? "&rArr;" : "");
}
this.selectedObjects = []; this.selectedObjects = [];
for (var i = 0; i < pathObjects.length; i++) for (var i = 0; i < pathObjects.length; i++)
{ {
this.selectedObjects[pathObjects[i].id] = 1; this.selectedObjects[pathObjects[i].id] = 1;
} }
this.message = this.message + ": ";
for (var i = 0; i < nodesPath.length; i++)
{
this.message = this.message + this.graph.FindVertex(nodesPath[i]).mainText + ((i < nodesPath.length - 1) ? "&rArr;" : "");
}
} }
this.outResultCallback(outputResult); this.outResultCallback(outputResult);