mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-04 00:36:45 +00:00
Fix search loop and path in non multi graph.
This commit is contained in:
parent
bbcdbb7294
commit
14cefec5c1
@ -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) ? "⇒" : "");
|
||||||
|
}
|
||||||
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) ? "⇒" : "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.outResultCallback(outputResult);
|
this.outResultCallback(outputResult);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user