Added multigraph support for hamiltonian loop/path

This commit is contained in:
Unick Soft
2020-04-01 21:21:20 +02:00
parent fe4f14970b
commit aa1be3fae5
5 changed files with 88 additions and 12 deletions

View File

@@ -52,9 +52,11 @@ FindHamiltonianLoop.prototype.resultCallback = function(pathObjects, properties,
this.message = result > 0 ? g_hasHamiltonianLoop : g_hasNotHamiltonianLoop;
if (result > 0)
{
var nodesPath = this.GetNodesPath(results, 1, results.length - 1);
outputResult["paths"] = [];
outputResult["paths"].push(nodesPath);
var nodesEdgesPath = this.GetNodesEdgesPath(results, 1, results.length - 1);
var nodesPath = this.GetNodesPath(results, 1, results.length - 1);
outputResult["pathsWithEdges"] = [];
outputResult["pathsWithEdges"].push(nodesEdgesPath);
this.selectedObjects = [];
for (var i = 0; i < pathObjects.length; i++)
@@ -82,6 +84,12 @@ FindHamiltonianLoop.prototype.getPriority = function()
return -5;
}
// Algorithm support multi graph
FindHamiltonianLoop.prototype.IsSupportMultiGraph = function()
{
return true;
}
// Factory for connected components.
function CreateFindHamiltonianLoop(graph, app)
{