Update algorithm limits and error handling

This commit is contained in:
Oleg Sh
2025-10-04 19:00:08 +02:00
parent e057a2d5ab
commit 46c05d94fd
31 changed files with 225 additions and 29 deletions

View File

@@ -152,6 +152,17 @@ BaseAlgorithm.prototype.IsSupportNegativeWeight = function()
return false;
}
// Limit by number of vertexes for the algorithm.
BaseAlgorithm.prototype.MaxGraphSize = function()
{
return 1000;
}
BaseAlgorithm.prototype.MaxEgdeNumber = function()
{
return 10000;
}
/**
* Default handler.
* Select using mouse, drag.
@@ -218,20 +229,16 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm = function(algorithmName, otherPara
var $xml = $( xmlDoc );
$results = $xml.find( "result" );
$results.each(function(){
$values = $(this).find( "value" );
$values.each(function(){
var type = $(this).attr('type');
var value = $(this).text();
var res = {};
res.type = type;
res.value = value;
result.push(res);
});
});
// Use native because jqueary hangs for results with 10000+ nodes.
let values = $results[0].getElementsByTagName("value");
for (var j = 0; j < values.length; j++)
{
var type = values[j].getAttribute('type');
var value = values[j].textContent;
result.push({ type: type, value: value });
}
$nodes = $xml.find( "node" );
$nodes.each(function(){