This commit is contained in:
/usr/bin/nano
2020-01-25 15:14:42 +03:00
11 changed files with 84 additions and 75 deletions

View File

@@ -53,6 +53,7 @@ FloidAlgorithm.prototype.result = function(resultCallback)
// Remove all edges.
this.egdesCopy = this.graph.edges.slice();
this.removeAllEdges();
this.isGraphMulti = this.graph.isMulti();
this.graph.hasDirect = false;
@@ -206,7 +207,13 @@ FloidAlgorithm.prototype.restore = function()
for (var i = 0; i < this.egdesCopy.length; i ++)
{
this.graph.AddNewEdgeSafe(this.egdesCopy[i].vertex1, this.egdesCopy[i].vertex2, this.egdesCopy[i].isDirect, this.egdesCopy[i].weight);
var edge = this.graph.AddNewEdgeSafe(this.egdesCopy[i].vertex1,
this.egdesCopy[i].vertex2,
this.egdesCopy[i].isDirect,
this.egdesCopy[i].weight,
this.isGraphMulti);
//edge.model = this.egdesCopy[i].model;
}
}
@@ -216,6 +223,12 @@ FloidAlgorithm.prototype.updateMessage = function(save)
"<button type=\"button\" class=\"btn btn-default btn-xs\" id=\"showFloidMatrix\" style=\"float:right\">" + g_showDistMatrix + "</button>"
}
// Algorithm support multi graph
FloidAlgorithm.prototype.IsSupportMultiGraph = function ()
{
return false;
}
// Factory for connected components.
function CreateFloidAlgorithm(graph, app)
{

View File

@@ -73,6 +73,7 @@ MinimumSpanningTree.prototype.result = function(resultCallback)
var result = {};
result["version"] = 1;
result["minPath"] = true;
return result;
}
@@ -145,6 +146,12 @@ MinimumSpanningTree.prototype.getPriority = function()
return -9.5;
}
// Algorithm support multi graph
MinimumSpanningTree.prototype.IsSupportMultiGraph = function ()
{
return true;
}
// Factory for algorithm.
function CreateMinimumSpanningTree(graph, app)

View File

@@ -55,6 +55,7 @@ FindShortPathNew.prototype.resultCallback = function(pathObjects, properties, re
{
var outputResult = {};
outputResult["version"] = 1;
outputResult["minPath"] = true;
this.pathObjects = pathObjects;
this.properties = properties;
@@ -205,6 +206,12 @@ FindShortPathNew.prototype.getPriority = function()
return -10;
}
// Algorithm support multi graph
FindShortPathNew.prototype.IsSupportMultiGraph = function ()
{
return true;
}
// Factory for connected components.
function CreateFindShortPathNew(graph, app)