mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-03 06:16:20 +00:00
Added multigraph support for hamiltonian loop/path
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -52,9 +52,11 @@ FindHamiltonianPath.prototype.resultCallback = function(pathObjects, properties,
|
||||
this.message = result > 0 ? g_hasHamiltonianPath : g_hasNotHamiltonianPath;
|
||||
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,11 @@ FindHamiltonianPath.prototype.getPriority = function()
|
||||
return -5;
|
||||
}
|
||||
|
||||
FindHamiltonianPath.prototype.IsSupportMultiGraph = function()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateFindHamiltonianPath(graph, app)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user