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

@@ -94,5 +94,5 @@
$g_config['vote'] = "./tmp/vote/vote.txt"; $g_config['vote'] = "./tmp/vote/vote.txt";
$g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_"; $g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_";
$g_config['use_js_cache'] = true; $g_config['use_js_cache'] = true;
$g_config['engine_version'] = 101; $g_config['engine_version'] = 102;
?> ?>

View File

@@ -331,4 +331,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -333,4 +333,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -332,4 +332,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -290,4 +290,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -329,4 +329,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -334,4 +334,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -333,4 +333,8 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -300,4 +300,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -297,4 +297,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -333,4 +333,8 @@ Dodaliśmy polskie tłumaczenie, Patryk</a>";
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -298,4 +298,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -339,4 +339,7 @@
$g_lang['number_of_shortest_pathes_from'] = "Количество кратчайших путей из "; $g_lang['number_of_shortest_pathes_from'] = "Количество кратчайших путей из ";
$g_lang['length_is'] = "длина равна "; $g_lang['length_is'] = "длина равна ";
$g_lang['graph_is_to_large'] = "Граф слишком большой для этого алгоритма (<span id=\"current_graph_size\">X</span> вершин, <span id=\"current_edge_number\">X</span> дуг).";
$g_lang['algorith_supports_max_limit'] = "Алгоритм поддерживает графы размером не больше <span id=\"algorithm_max_limit\">X</span> вершин и <span id=\"algorithm_edge_limit\">X</span> дуг.";
$g_lang['error'] = "Ошибка";
?> ?>

View File

@@ -294,4 +294,8 @@
$g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices"; $g_lang['find_all_shortest_pathes'] = "Find all shortest paths between 2 vertices";
$g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from "; $g_lang['number_of_shortest_pathes_from'] = "Number of shortest paths from ";
$g_lang['length_is'] = "length is "; $g_lang['length_is'] = "length is ";
$g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (<span id=\"current_graph_size\">X</span> vertices, <span id=\"current_edge_number\">X</span> edges).";
$g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than <span id=\"algorithm_max_limit\">X</span> vertices and <span id=\"algorithm_edge_limit\">X</span> edges.";
$g_lang['error'] = "Error";
?> ?>

View File

@@ -336,4 +336,8 @@
$g_lang['find_all_shortest_pathes'] = "Знайти всі найкоротші шляхі між вершинами"; $g_lang['find_all_shortest_pathes'] = "Знайти всі найкоротші шляхі між вершинами";
$g_lang['number_of_shortest_pathes_from'] = "Кількість найкоротших шляхів з "; $g_lang['number_of_shortest_pathes_from'] = "Кількість найкоротших шляхів з ";
$g_lang['length_is'] = "довжина рівна "; $g_lang['length_is'] = "довжина рівна ";
$g_lang['graph_is_to_large'] = "Граф слишком большой для этого алгоритма (<span id=\"current_graph_size\">X</span> вершин, <span id=\"current_edge_number\">X</span> дуг).";
$g_lang['algorith_supports_max_limit'] = "Алгоритм поддерживает графы размером не больше <span id=\"algorithm_max_limit\">X</span> вершин и <span id=\"algorithm_edge_limit\">X</span> дуг.";
$g_lang['error'] = "Ошибка";
?> ?>

View File

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

View File

@@ -35,6 +35,16 @@ FindEulerianLoop.prototype.getCategory = function()
return 1; return 1;
} }
FindEulerianLoop.prototype.MaxGraphSize = function()
{
return 50;
}
FindEulerianLoop.prototype.MaxEgdeNumber = function()
{
return 500;
}
FindEulerianLoop.prototype.result = function(resultCallback) FindEulerianLoop.prototype.result = function(resultCallback)
{ {
this.outResultCallback = function (result ) { resultCallback(result); }; this.outResultCallback = function (result ) { resultCallback(result); };

View File

@@ -35,6 +35,16 @@ FindEulerianPath.prototype.getCategory = function()
return 1; return 1;
} }
FindEulerianPath.prototype.MaxGraphSize = function()
{
return 50;
}
FindEulerianPath.prototype.MaxEgdeNumber = function()
{
return 500;
}
FindEulerianPath.prototype.result = function(resultCallback) FindEulerianPath.prototype.result = function(resultCallback)
{ {
this.outResultCallback = function (result ) { resultCallback(result); }; this.outResultCallback = function (result ) { resultCallback(result); };

View File

@@ -46,6 +46,16 @@ FindAllPathes.prototype.getCategory = function()
return 1; return 1;
} }
FindAllPathes.prototype.MaxGraphSize = function()
{
return 50;
}
FindAllPathes.prototype.MaxEgdeNumber = function()
{
return 40;
}
FindAllPathes.prototype.result = function(resultCallback) FindAllPathes.prototype.result = function(resultCallback)
{ {
if (this.firstObject && this.secondObject) if (this.firstObject && this.secondObject)

View File

@@ -47,6 +47,16 @@ FindAllShortestPathes.prototype.getCategory = function()
return 1; return 1;
} }
FindAllShortestPathes.prototype.MaxGraphSize = function()
{
return 50;
}
FindAllShortestPathes.prototype.MaxEgdeNumber = function()
{
return 40;
}
FindAllShortestPathes.prototype.result = function(resultCallback) FindAllShortestPathes.prototype.result = function(resultCallback)
{ {
if (this.firstObject && this.secondObject) if (this.firstObject && this.secondObject)

View File

@@ -47,6 +47,16 @@ FindLongestPath.prototype.getCategory = function()
return 1; return 1;
} }
FindLongestPath.prototype.MaxGraphSize = function()
{
return 50;
}
FindLongestPath.prototype.MaxEgdeNumber = function()
{
return 40;
}
FindLongestPath.prototype.result = function(resultCallback) FindLongestPath.prototype.result = function(resultCallback)
{ {
if (this.firstObject && this.secondObject) if (this.firstObject && this.secondObject)

View File

@@ -35,6 +35,16 @@ FindHamiltonianLoop.prototype.getCategory = function()
return 1; return 1;
} }
FindHamiltonianLoop.prototype.MaxGraphSize = function()
{
return 30;
}
FindHamiltonianLoop.prototype.MaxEgdeNumber = function()
{
return 450;
}
FindHamiltonianLoop.prototype.result = function(resultCallback) FindHamiltonianLoop.prototype.result = function(resultCallback)
{ {
this.outResultCallback = function (result ) { resultCallback(result); }; this.outResultCallback = function (result ) { resultCallback(result); };

View File

@@ -35,6 +35,16 @@ FindHamiltonianPath.prototype.getCategory = function()
return 1; return 1;
} }
FindHamiltonianPath.prototype.MaxGraphSize = function()
{
return 30;
}
FindHamiltonianPath.prototype.MaxEgdeNumber = function()
{
return 450;
}
FindHamiltonianPath.prototype.result = function(resultCallback) FindHamiltonianPath.prototype.result = function(resultCallback)
{ {
this.outResultCallback = function (result ) { resultCallback(result); }; this.outResultCallback = function (result ) { resultCallback(result); };

View File

@@ -86,6 +86,16 @@ MaxIndependentSet.prototype.getPriority = function()
return -5; return -5;
} }
MaxIndependentSet.prototype.MaxGraphSize = function()
{
return 100;
}
MaxIndependentSet.prototype.MaxEgdeNumber = function()
{
return 4000;
}
MaxIndependentSet.prototype.IsSupportNegativeWeight = function() MaxIndependentSet.prototype.IsSupportNegativeWeight = function()
{ {
return true; return true;

View File

@@ -1,4 +1,4 @@
moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=101","/script/shared/point.js?v=101","/script/entities/edge/api/index.js?v=101","/script/entities/edge/model/BaseEdge.js?v=101","/script/entities/edge/model/EdgeModel.js?v=101","/script/entities/vertex/api/index.js?v=101","/script/entities/vertex/model/BaseVertex.js?v=101","/script/entities/vertex/model/VertexModel.js?v=101","/script/entities/graph/model/Graph.js?v=101",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);} moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=102","/script/shared/point.js?v=102","/script/entities/edge/api/index.js?v=102","/script/entities/edge/model/BaseEdge.js?v=102","/script/entities/edge/model/EdgeModel.js?v=102","/script/entities/vertex/api/index.js?v=102","/script/entities/vertex/model/BaseVertex.js?v=102","/script/entities/vertex/model/VertexModel.js?v=102","/script/entities/graph/model/Graph.js?v=102",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);}
{let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point)
{return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point)
{return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

View File

@@ -1,4 +1,4 @@
moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=101","/script/shared/point.js?v=101","/script/entities/edge/api/index.js?v=101","/script/entities/edge/model/BaseEdge.js?v=101","/script/entities/edge/model/EdgeModel.js?v=101","/script/entities/vertex/api/index.js?v=101","/script/entities/vertex/model/BaseVertex.js?v=101","/script/entities/vertex/model/VertexModel.js?v=101","/script/entities/graph/model/Graph.js?v=101",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js")]);} moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=102","/script/shared/point.js?v=102","/script/entities/edge/api/index.js?v=102","/script/entities/edge/model/BaseEdge.js?v=102","/script/entities/edge/model/EdgeModel.js?v=102","/script/entities/vertex/api/index.js?v=102","/script/entities/vertex/model/BaseVertex.js?v=102","/script/entities/vertex/model/VertexModel.js?v=102","/script/entities/graph/model/Graph.js?v=102",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js")]);}
{let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point)
{return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point)
{return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

View File

@@ -1,4 +1,4 @@
moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=101","/script/shared/point.js?v=101","/script/entities/edge/api/index.js?v=101","/script/entities/edge/model/BaseEdge.js?v=101","/script/entities/edge/model/EdgeModel.js?v=101","/script/entities/vertex/api/index.js?v=101","/script/entities/vertex/model/BaseVertex.js?v=101","/script/entities/vertex/model/VertexModel.js?v=101","/script/entities/graph/model/Graph.js?v=101","/script/pages/create_graph_by_matrix/model/createByMatrixMain.js?v=101","/script/pages/create_graph_by_matrix/model/main.js?v=101",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js"),include("model/createByMatrixMain.js",modulDir),include("model/main.js",modulDir)]);} moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=102","/script/shared/point.js?v=102","/script/entities/edge/api/index.js?v=102","/script/entities/edge/model/BaseEdge.js?v=102","/script/entities/edge/model/EdgeModel.js?v=102","/script/entities/vertex/api/index.js?v=102","/script/entities/vertex/model/BaseVertex.js?v=102","/script/entities/vertex/model/VertexModel.js?v=102","/script/entities/graph/model/Graph.js?v=102","/script/pages/create_graph_by_matrix/model/createByMatrixMain.js?v=102","/script/pages/create_graph_by_matrix/model/main.js?v=102",]);{let modulDir="pages/create_graph_by_matrix/";doInclude([include("entities/graph/api/index.js"),include("model/createByMatrixMain.js",modulDir),include("model/main.js",modulDir)]);}
{let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point)
{return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point)
{return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function()

File diff suppressed because one or more lines are too long

View File

@@ -222,6 +222,8 @@ var g_FindAllShortestPathes = "Find all shortest paths";
var g_numberOfShortestPathesFrom = "Number of shortest paths from "; var g_numberOfShortestPathesFrom = "Number of shortest paths from ";
var g_length_is = "length is "; var g_length_is = "length is ";
var g_error = "Error";
function loadTexts() function loadTexts()
{ {
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML; g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
@@ -451,4 +453,6 @@ function loadTexts()
g_FindAllShortestPathes = document.getElementById("findAllShortestPathes").innerHTML; g_FindAllShortestPathes = document.getElementById("findAllShortestPathes").innerHTML;
g_numberOfShortestPathesFrom = document.getElementById("numberOfShortestPathesFrom").innerHTML; g_numberOfShortestPathesFrom = document.getElementById("numberOfShortestPathesFrom").innerHTML;
g_length_is = document.getElementById("lengthIs").innerHTML; g_length_is = document.getElementById("lengthIs").innerHTML;
g_error = document.getElementById("error").innerHTML;
} }

View File

@@ -687,9 +687,41 @@ Editor.prototype.createAlgorithmMenu = function()
{ {
e["closeThisMenu"] = true; e["closeThisMenu"] = true;
userAction(this.id); userAction(this.id);
self.restButtons ("");
self.application.SetHandler(new AlgorithmGraphHandler(self.application, let algorithm = g_Algorithms[g_AlgorithmIds.indexOf(this.id)](self.application.graph, self.application);
g_Algorithms[g_AlgorithmIds.indexOf(this.id)](self.application.graph, self.application))); let is_vertex_fits_to_limits = self.application.graph.vertices.length <= algorithm.MaxGraphSize()
let is_edge_fits_to_limits = self.application.graph.edges.length <= algorithm.MaxEgdeNumber();
if (is_vertex_fits_to_limits && is_edge_fits_to_limits)
{
self.restButtons ("");
self.application.SetHandler(new AlgorithmGraphHandler(self.application, algorithm));
}
else
{
let warring_cond_begin = "<span class=\"text-danger\">";
let warring_cond_end = "</span>";
$("#current_graph_size").html((is_vertex_fits_to_limits ? "" : warring_cond_begin ) + self.application.graph.vertices.length
+ (is_vertex_fits_to_limits ? "" : warring_cond_end ));
$("#current_edge_number").html((is_edge_fits_to_limits ? "" : warring_cond_begin ) + self.application.graph.edges.length
+ (is_edge_fits_to_limits ? "" : warring_cond_end ));
$("#algorithm_max_limit").html(algorithm.MaxGraphSize());
$("#algorithm_edge_limit").html(algorithm.MaxEgdeNumber());
var dialogButtons = {};
dialogButtons[g_close] = function() {
$( this ).dialog( "close" );
};
// Show error message that graph is too large.
$("#graphMaxVerexLimit").dialog({
resizable: false,
title: g_error,
width: 400,
modal: true,
dialogClass: 'EdgeDialog',
buttons: dialogButtons,
});
}
} }
var eventData = {}; var eventData = {};

View File

@@ -481,16 +481,21 @@
<div id="matrixError" class="translation"> <div id="matrixError" class="translation">
<div><span class="bi bi-remove-sign text-danger"></span> <?= L('bad_adj_matrix_message')?></div> <div><span class="bi bi-exclamation-octagon-fill text-danger"></span> <?= L('bad_adj_matrix_message')?></div>
</div> </div>
<div id="matrixErrorInc" class="translation"> <div id="matrixErrorInc" class="translation">
<div><span class="bi bi-remove-sign text-danger"></span> <?= L('bad_inc_matrix_message')?></div> <div><span class="bi bi-exclamation-octagon-fill text-danger"></span> <?= L('bad_inc_matrix_message')?></div>
</div> </div>
<div id="pairErrorInc" class="translation"> <div id="pairErrorInc" class="translation">
<div><span class="bi bi-remove-sign text-danger"></span> <?= L('bad_inc_pair_message')?></div> <div><span class="bi bi-exclamation-octagon-fill text-danger"></span> <?= L('bad_inc_pair_message')?></div>
</div> </div>
<div id="graphMaxVerexLimit" class="translation">
<div><span class="bi bi-exclamation-octagon-fill text-danger"></span> <?= L('graph_is_to_large')?></div>
<div><span class="bi bi-info-circle-fill text-info"></span> <?= L('algorith_supports_max_limit')?></div>
</div>
<div id="voteDialog"> <div id="voteDialog">
<form> <form>
@@ -991,6 +996,7 @@
<p id="findAllShortestPathes" class="translation"><?= L('find_all_shortest_pathes')?></p> <p id="findAllShortestPathes" class="translation"><?= L('find_all_shortest_pathes')?></p>
<p id="numberOfShortestPathesFrom" class="translation"><?= L('number_of_shortest_pathes_from')?></p> <p id="numberOfShortestPathesFrom" class="translation"><?= L('number_of_shortest_pathes_from')?></p>
<p id="lengthIs" class="translation"><?= L('length_is')?></p> <p id="lengthIs" class="translation"><?= L('length_is')?></p>
<p id="error" class="translation"><?= L('error')?></p>
</section> </section>
<script src="<?= RootCacheJS("script/pages/editor/api/index.js")?>" ></script> <script src="<?= RootCacheJS("script/pages/editor/api/index.js")?>" ></script>