Added multi graph supports for some algorithms.

This commit is contained in:
Oleg Sh
2020-01-25 13:18:26 +02:00
parent 7f3ae378c9
commit 0059cebea0
8 changed files with 83 additions and 74 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)
{