Add Emsctipted implementation for algorithm.

This commit is contained in:
Oleg Sh
2021-12-08 21:48:50 +02:00
parent 056d4fce12
commit 513fb80a0c
15 changed files with 128 additions and 70 deletions

View File

@@ -34,7 +34,7 @@ FindEulerianLoop.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("elloop=cgiInput&report=xml", function (pathObjects, properties, results)
this.CalculateAlgorithm("elloop", [], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
}, true);

View File

@@ -34,7 +34,7 @@ FindEulerianPath.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("elpath=cgiInput&report=xml", function (pathObjects, properties, results)
this.CalculateAlgorithm("elpath", [], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
}, true);

View File

@@ -46,10 +46,14 @@ FindAllPathes.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("prnpaths=cgiInput&start=" + this.firstObject.id + "&finish=" + this.secondObject.id + "&report=xml", function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
this.CalculateAlgorithm("prnpaths", [
{name: "start", value: this.firstObject.id},
{name: "finish", value: this.secondObject.id}
],
function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
}
return null;
}

View File

@@ -46,10 +46,12 @@ FindShortPatchsFromOne.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("blf=cgiInput&start=" + this.firstObject.id + "&report=xml", function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
this.CalculateAlgorithm("blf", [
{name: "start", value : this.firstObject.id}
], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
}
return null;
}

View File

@@ -76,19 +76,6 @@ FloidAlgorithm.prototype.result = function(resultCallback)
this.app.redrawGraph();
return result;
/*
if (this.firstObject && this.secondObject)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("dsp=cgiInput&start=" + this.firstObject.id + "&finish=" + this.secondObject.id + "&report=xml", function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
}
return null;
*/
}

View File

@@ -34,7 +34,7 @@ FindHamiltonianLoop.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("hamloop=cgiInput&report=xml", function (pathObjects, properties, results)
this.CalculateAlgorithm("hamloop", [], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});

View File

@@ -34,7 +34,7 @@ FindHamiltonianPath.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("hampath=cgiInput&report=xml", function (pathObjects, properties, results)
this.CalculateAlgorithm("hampath", [], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});

View File

@@ -53,7 +53,14 @@ IsomorphismCheck.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("isocheck=cgiInput&graph1=" + this.getGraphEdges(this.firstGraph) + "&graph2=" + this.getGraphEdges(this.secondGraph) + "&report=xml" + (this.searchSubGraphs ? "&searchSubgraphs=true": ""), function (pathObjects, properties, results)
var params = [
{name : "graph1", value: this.getGraphEdges(this.firstGraph)},
{name : "graph2", value: this.getGraphEdges(this.secondGraph)},
];
if (this.searchSubGraphs) {
params.push({name: "searchSubgraphs", value: true});
}
this.CalculateAlgorithm("isocheck", params, function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});

View File

@@ -47,10 +47,15 @@ FindMaxFlow.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("mfpr=cgiInput&source=" + this.firstObject.id + "&drain=" + this.secondObject.id + "&report=xml", function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
this.CalculateAlgorithm("mfpr",
[
{name: "source", value: this.firstObject.id},
{name: "drain", value: this.secondObject.id}
],
function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
}
return null;
}

View File

@@ -43,10 +43,14 @@ FindShortPathNew.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("dsp=cgiInput&start=" + this.firstObject.id + "&finish=" + this.secondObject.id + "&report=xml", function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
this.CalculateAlgorithm("dsp",
[
{name: "start", value: this.firstObject.id},
{name: "finish", value: this.secondObject.id}
], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
}
return null;
}