From 46c05d94fdfcaf2f57c12ae0b1fb3b5409a5ea8a Mon Sep 17 00:00:00 2001 From: Oleg Sh Date: Sat, 4 Oct 2025 19:00:08 +0200 Subject: [PATCH] Update algorithm limits and error handling --- core/config/main.php | 2 +- lang/bg/home.php | 4 ++ lang/ch/home.php | 4 ++ lang/cs/home.php | 4 ++ lang/de/home.php | 4 ++ lang/el/home.php | 4 ++ lang/en/home.php | 4 ++ lang/es/home.php | 4 ++ lang/fr/home.php | 4 ++ lang/nl/home.php | 4 ++ lang/pl/home.php | 4 ++ lang/pt/home.php | 4 ++ lang/ru/home.php | 3 ++ lang/sv/home.php | 4 ++ lang/ua/home.php | 4 ++ .../features/algorithms/model/Algorithms.js | 35 ++++++++++------- .../algorithms/model/plugins/EulerianLoop.js | 10 +++++ .../algorithms/model/plugins/EulerianPath.js | 10 +++++ .../model/plugins/FindAllPatches.js | 10 +++++ .../model/plugins/FindAllShortestPatches.js | 10 +++++ .../model/plugins/FindLongestPath.js | 10 +++++ .../model/plugins/HamiltonianLoop.js | 10 +++++ .../model/plugins/HamiltonianPath.js | 10 +++++ .../model/plugins/MaxIndependentSet.js | 10 +++++ .../api/index.js.cache | 2 +- .../api/index.js.cache | 2 +- .../create_graph_by_matrix/api/index.js.cache | 2 +- script/pages/editor/api/index.js.cache | 22 ++++++++--- script/pages/editor/model/texts.js | 4 ++ script/pages/editor/ui/editor.js | 38 +++++++++++++++++-- tpl/home.php | 12 ++++-- 31 files changed, 225 insertions(+), 29 deletions(-) diff --git a/core/config/main.php b/core/config/main.php index b257693..904f8b0 100755 --- a/core/config/main.php +++ b/core/config/main.php @@ -94,5 +94,5 @@ $g_config['vote'] = "./tmp/vote/vote.txt"; $g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_"; $g_config['use_js_cache'] = true; - $g_config['engine_version'] = 101; + $g_config['engine_version'] = 102; ?> diff --git a/lang/bg/home.php b/lang/bg/home.php index 123d7e3..8b39773 100644 --- a/lang/bg/home.php +++ b/lang/bg/home.php @@ -331,4 +331,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit"; $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/ch/home.php b/lang/ch/home.php index e50e3af..c441f17 100644 --- a/lang/ch/home.php +++ b/lang/ch/home.php @@ -333,4 +333,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/cs/home.php b/lang/cs/home.php index 7afc6cf..4e14871 100644 --- a/lang/cs/home.php +++ b/lang/cs/home.php @@ -332,4 +332,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> \ No newline at end of file diff --git a/lang/de/home.php b/lang/de/home.php index e97f4b2..be7f965 100644 --- a/lang/de/home.php +++ b/lang/de/home.php @@ -290,4 +290,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/el/home.php b/lang/el/home.php index 9b75234..49fdfbf 100644 --- a/lang/el/home.php +++ b/lang/el/home.php @@ -329,4 +329,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/en/home.php b/lang/en/home.php index 502c74b..336dfa5 100755 --- a/lang/en/home.php +++ b/lang/en/home.php @@ -334,4 +334,8 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit"; $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/es/home.php b/lang/es/home.php index 9de5fd4..831ce79 100755 --- a/lang/es/home.php +++ b/lang/es/home.php @@ -333,4 +333,8 @@ Tenemos traducciones en griego 🇬🇷. X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/fr/home.php b/lang/fr/home.php index 5eddfe3..5651ca4 100644 --- a/lang/fr/home.php +++ b/lang/fr/home.php @@ -300,4 +300,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/nl/home.php b/lang/nl/home.php index 0398061..c1e9d89 100644 --- a/lang/nl/home.php +++ b/lang/nl/home.php @@ -297,4 +297,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/pl/home.php b/lang/pl/home.php index fea0621..8642319 100644 --- a/lang/pl/home.php +++ b/lang/pl/home.php @@ -333,4 +333,8 @@ Dodaliśmy polskie tłumaczenie, Patryk"; $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/pt/home.php b/lang/pt/home.php index 30bb5e1..2b948ae 100644 --- a/lang/pt/home.php +++ b/lang/pt/home.php @@ -298,4 +298,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/ru/home.php b/lang/ru/home.php index 176d4c1..c163efd 100755 --- a/lang/ru/home.php +++ b/lang/ru/home.php @@ -339,4 +339,7 @@ $g_lang['number_of_shortest_pathes_from'] = "Количество кратчайших путей из "; $g_lang['length_is'] = "длина равна "; + $g_lang['graph_is_to_large'] = "Граф слишком большой для этого алгоритма (X вершин, X дуг)."; + $g_lang['algorith_supports_max_limit'] = "Алгоритм поддерживает графы размером не больше X вершин и X дуг."; + $g_lang['error'] = "Ошибка"; ?> diff --git a/lang/sv/home.php b/lang/sv/home.php index 2e1e27b..b962777 100644 --- a/lang/sv/home.php +++ b/lang/sv/home.php @@ -294,4 +294,8 @@ $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['length_is'] = "length is "; + + $g_lang['graph_is_to_large'] = "The graph is too large for this algorithm (X vertices, X edges)."; + $g_lang['algorith_supports_max_limit'] = "The algorithm supports graphs of size no larger than X vertices and X edges."; + $g_lang['error'] = "Error"; ?> diff --git a/lang/ua/home.php b/lang/ua/home.php index 84e689b..5147e46 100644 --- a/lang/ua/home.php +++ b/lang/ua/home.php @@ -336,4 +336,8 @@ $g_lang['find_all_shortest_pathes'] = "Знайти всі найкоротші шляхі між вершинами"; $g_lang['number_of_shortest_pathes_from'] = "Кількість найкоротших шляхів з "; $g_lang['length_is'] = "довжина рівна "; + + $g_lang['graph_is_to_large'] = "Граф слишком большой для этого алгоритма (X вершин, X дуг)."; + $g_lang['algorith_supports_max_limit'] = "Алгоритм поддерживает графы размером не больше X вершин и X дуг."; + $g_lang['error'] = "Ошибка"; ?> diff --git a/script/features/algorithms/model/Algorithms.js b/script/features/algorithms/model/Algorithms.js index 8e7aeb0..f18f6d2 100644 --- a/script/features/algorithms/model/Algorithms.js +++ b/script/features/algorithms/model/Algorithms.js @@ -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(){ diff --git a/script/features/algorithms/model/plugins/EulerianLoop.js b/script/features/algorithms/model/plugins/EulerianLoop.js index 9bfed35..2d930de 100644 --- a/script/features/algorithms/model/plugins/EulerianLoop.js +++ b/script/features/algorithms/model/plugins/EulerianLoop.js @@ -35,6 +35,16 @@ FindEulerianLoop.prototype.getCategory = function() return 1; } +FindEulerianLoop.prototype.MaxGraphSize = function() +{ + return 50; +} + +FindEulerianLoop.prototype.MaxEgdeNumber = function() +{ + return 500; +} + FindEulerianLoop.prototype.result = function(resultCallback) { this.outResultCallback = function (result ) { resultCallback(result); }; diff --git a/script/features/algorithms/model/plugins/EulerianPath.js b/script/features/algorithms/model/plugins/EulerianPath.js index a6b81ae..a54fc27 100644 --- a/script/features/algorithms/model/plugins/EulerianPath.js +++ b/script/features/algorithms/model/plugins/EulerianPath.js @@ -35,6 +35,16 @@ FindEulerianPath.prototype.getCategory = function() return 1; } +FindEulerianPath.prototype.MaxGraphSize = function() +{ + return 50; +} + +FindEulerianPath.prototype.MaxEgdeNumber = function() +{ + return 500; +} + FindEulerianPath.prototype.result = function(resultCallback) { this.outResultCallback = function (result ) { resultCallback(result); }; diff --git a/script/features/algorithms/model/plugins/FindAllPatches.js b/script/features/algorithms/model/plugins/FindAllPatches.js index d42e28d..457ccf7 100644 --- a/script/features/algorithms/model/plugins/FindAllPatches.js +++ b/script/features/algorithms/model/plugins/FindAllPatches.js @@ -46,6 +46,16 @@ FindAllPathes.prototype.getCategory = function() return 1; } +FindAllPathes.prototype.MaxGraphSize = function() +{ + return 50; +} + +FindAllPathes.prototype.MaxEgdeNumber = function() +{ + return 40; +} + FindAllPathes.prototype.result = function(resultCallback) { if (this.firstObject && this.secondObject) diff --git a/script/features/algorithms/model/plugins/FindAllShortestPatches.js b/script/features/algorithms/model/plugins/FindAllShortestPatches.js index be3ead8..ea0dfe6 100644 --- a/script/features/algorithms/model/plugins/FindAllShortestPatches.js +++ b/script/features/algorithms/model/plugins/FindAllShortestPatches.js @@ -47,6 +47,16 @@ FindAllShortestPathes.prototype.getCategory = function() return 1; } +FindAllShortestPathes.prototype.MaxGraphSize = function() +{ + return 50; +} + +FindAllShortestPathes.prototype.MaxEgdeNumber = function() +{ + return 40; +} + FindAllShortestPathes.prototype.result = function(resultCallback) { if (this.firstObject && this.secondObject) diff --git a/script/features/algorithms/model/plugins/FindLongestPath.js b/script/features/algorithms/model/plugins/FindLongestPath.js index efb1edc..b0456de 100644 --- a/script/features/algorithms/model/plugins/FindLongestPath.js +++ b/script/features/algorithms/model/plugins/FindLongestPath.js @@ -47,6 +47,16 @@ FindLongestPath.prototype.getCategory = function() return 1; } +FindLongestPath.prototype.MaxGraphSize = function() +{ + return 50; +} + +FindLongestPath.prototype.MaxEgdeNumber = function() +{ + return 40; +} + FindLongestPath.prototype.result = function(resultCallback) { if (this.firstObject && this.secondObject) diff --git a/script/features/algorithms/model/plugins/HamiltonianLoop.js b/script/features/algorithms/model/plugins/HamiltonianLoop.js index 4d58f39..cc3d711 100644 --- a/script/features/algorithms/model/plugins/HamiltonianLoop.js +++ b/script/features/algorithms/model/plugins/HamiltonianLoop.js @@ -35,6 +35,16 @@ FindHamiltonianLoop.prototype.getCategory = function() return 1; } +FindHamiltonianLoop.prototype.MaxGraphSize = function() +{ + return 30; +} + +FindHamiltonianLoop.prototype.MaxEgdeNumber = function() +{ + return 450; +} + FindHamiltonianLoop.prototype.result = function(resultCallback) { this.outResultCallback = function (result ) { resultCallback(result); }; diff --git a/script/features/algorithms/model/plugins/HamiltonianPath.js b/script/features/algorithms/model/plugins/HamiltonianPath.js index 5c29bef..3efe4ee 100644 --- a/script/features/algorithms/model/plugins/HamiltonianPath.js +++ b/script/features/algorithms/model/plugins/HamiltonianPath.js @@ -35,6 +35,16 @@ FindHamiltonianPath.prototype.getCategory = function() return 1; } +FindHamiltonianPath.prototype.MaxGraphSize = function() +{ + return 30; +} + +FindHamiltonianPath.prototype.MaxEgdeNumber = function() +{ + return 450; +} + FindHamiltonianPath.prototype.result = function(resultCallback) { this.outResultCallback = function (result ) { resultCallback(result); }; diff --git a/script/features/algorithms/model/plugins/MaxIndependentSet.js b/script/features/algorithms/model/plugins/MaxIndependentSet.js index 1dfa479..31296d6 100644 --- a/script/features/algorithms/model/plugins/MaxIndependentSet.js +++ b/script/features/algorithms/model/plugins/MaxIndependentSet.js @@ -86,6 +86,16 @@ MaxIndependentSet.prototype.getPriority = function() return -5; } +MaxIndependentSet.prototype.MaxGraphSize = function() +{ + return 100; +} + +MaxIndependentSet.prototype.MaxEgdeNumber = function() +{ + return 4000; +} + MaxIndependentSet.prototype.IsSupportNegativeWeight = function() { return true; diff --git a/script/pages/create_graph_by_edge_list/api/index.js.cache b/script/pages/create_graph_by_edge_list/api/index.js.cache index cf5547a..131f613 100644 --- a/script/pages/create_graph_by_edge_list/api/index.js.cache +++ b/script/pages/create_graph_by_edge_list/api/index.js.cache @@ -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) {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() diff --git a/script/pages/create_graph_by_incidence_matrix/api/index.js.cache b/script/pages/create_graph_by_incidence_matrix/api/index.js.cache index 0ead0bb..5b9100d 100644 --- a/script/pages/create_graph_by_incidence_matrix/api/index.js.cache +++ b/script/pages/create_graph_by_incidence_matrix/api/index.js.cache @@ -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) {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() diff --git a/script/pages/create_graph_by_matrix/api/index.js.cache b/script/pages/create_graph_by_matrix/api/index.js.cache index ac8d0f3..a5eb9fb 100644 --- a/script/pages/create_graph_by_matrix/api/index.js.cache +++ b/script/pages/create_graph_by_matrix/api/index.js.cache @@ -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) {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() diff --git a/script/pages/editor/api/index.js.cache b/script/pages/editor/api/index.js.cache index fdddaf8..5302d29 100644 --- a/script/pages/editor/api/index.js.cache +++ b/script/pages/editor/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/shared/utils.js?v=101","/script/shared/gzip.js?v=101","/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/features/draw_graph/api/index.js?v=101","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=101","/script/features/draw_graph/model/EdgeStyle.js?v=101","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=101","/script/features/draw_graph/model/VertexShape.js?v=101","/script/features/draw_graph/model/VertexStyle.js?v=101","/script/features/draw_graph/model/BaseVertexDrawer.js?v=101","/script/features/draw_graph/model/GraphFullStyle.js?v=101","/script/features/algorithms/api/index.js?v=101","/script/features/algorithms/model/Algorithms.js?v=101","/script/features/algorithms/model/BaseTraversal.js?v=101","/script/features/base_handler/index.js?v=101","/script/features/default_handler/index.js?v=101","/script/features/add_vertices_handler/index.js?v=101","/script/features/connect_vertices_handler/index.js?v=101","/script/features/delete_objects_handler/index.js?v=101","/script/features/algorithm_handler/index.js?v=101","/script/features/select_auto_save_graph_or_not/index.js?v=101","/script/features/graph_preview/index.js?v=101","/script/features/serialization/api/index.js?v=101","/script/features/serialization/model/GraphMLCreator.js?v=101","/script/features/enum_vertices/EnumVertices.js?v=101","/script/pages/editor/model/texts.js?v=101","/script/pages/editor/model/UndoStack.js?v=101","/script/pages/editor/model/DiskSaveLoad.js?v=101","/script/pages/editor/model/Application.js?v=101","/script/pages/editor/ui/ya_metrika.js?v=101","/script/pages/editor/ui/editor.js?v=101","/script/pages/editor/ui/main.js?v=101",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.min.js"),include("features/group_rename_handler/index.js"),include("features/saved_graph_handler/index.js"),include("features/saved_graph_image_handler/index.js"),include("features/show_adjacency_matrix/index.js"),include("features/show_distance_matrix/index.js"),include("features/show_incidence_matrix/index.js"),include("features/setup_background_style/index.js"),include("features/setup_edge_style/index.js"),include("features/setup_vertex_style/index.js"),]);postLoadPage();} +moduleLoader.beginCacheLoading(["/script/shared/utils.js?v=102","/script/shared/gzip.js?v=102","/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/features/draw_graph/api/index.js?v=102","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=102","/script/features/draw_graph/model/EdgeStyle.js?v=102","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=102","/script/features/draw_graph/model/VertexShape.js?v=102","/script/features/draw_graph/model/VertexStyle.js?v=102","/script/features/draw_graph/model/BaseVertexDrawer.js?v=102","/script/features/draw_graph/model/GraphFullStyle.js?v=102","/script/features/algorithms/api/index.js?v=102","/script/features/algorithms/model/Algorithms.js?v=102","/script/features/algorithms/model/BaseTraversal.js?v=102","/script/features/base_handler/index.js?v=102","/script/features/default_handler/index.js?v=102","/script/features/add_vertices_handler/index.js?v=102","/script/features/connect_vertices_handler/index.js?v=102","/script/features/delete_objects_handler/index.js?v=102","/script/features/algorithm_handler/index.js?v=102","/script/features/select_auto_save_graph_or_not/index.js?v=102","/script/features/graph_preview/index.js?v=102","/script/features/serialization/api/index.js?v=102","/script/features/serialization/model/GraphMLCreator.js?v=102","/script/features/enum_vertices/EnumVertices.js?v=102","/script/pages/editor/model/texts.js?v=102","/script/pages/editor/model/UndoStack.js?v=102","/script/pages/editor/model/DiskSaveLoad.js?v=102","/script/pages/editor/model/Application.js?v=102","/script/pages/editor/ui/ya_metrika.js?v=102","/script/pages/editor/ui/editor.js?v=102","/script/pages/editor/ui/main.js?v=102",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.min.js"),include("features/group_rename_handler/index.js"),include("features/saved_graph_handler/index.js"),include("features/saved_graph_image_handler/index.js"),include("features/show_adjacency_matrix/index.js"),include("features/show_distance_matrix/index.js"),include("features/show_incidence_matrix/index.js"),include("features/setup_background_style/index.js"),include("features/setup_edge_style/index.js"),include("features/setup_vertex_style/index.js"),]);postLoadPage();} let modulDir="pages/editor/";doInclude([include("shared/utils.js"),include("shared/gzip.js"),include("entities/graph/api/index.js"),include("features/draw_graph/api/index.js"),include("features/algorithms/api/index.js"),include("features/base_handler/index.js"),include("features/default_handler/index.js"),include("features/add_vertices_handler/index.js"),include("features/connect_vertices_handler/index.js"),include("features/delete_objects_handler/index.js"),include("features/algorithm_handler/index.js"),include("features/select_auto_save_graph_or_not/index.js"),include("features/serialization/api/index.js"),include("features/enum_vertices/EnumVertices.js"),include("model/texts.js",modulDir),include("model/UndoStack.js",modulDir),include("model/DiskSaveLoad.js",modulDir),include("model/Application.js",modulDir),include("ui/ya_metrika.js",modulDir),include("ui/editor.js",modulDir),include("ui/main.js",modulDir)],onloadEditor);} function gEncodeToHTML(str) {if(typeof str!=='string') @@ -955,6 +955,10 @@ BaseAlgorithm.prototype.getCategory=function() {return 0;} BaseAlgorithm.prototype.IsSupportNegativeWeight=function() {return false;} +BaseAlgorithm.prototype.MaxGraphSize=function() +{return 1000;} +BaseAlgorithm.prototype.MaxEgdeNumber=function() +{return 10000;} function BaseAlgorithmEx(graph,app) {BaseAlgorithm.apply(this,arguments);} BaseAlgorithmEx.prototype=Object.create(BaseAlgorithm.prototype);class ProcessingMessage @@ -966,7 +970,9 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm=function(algorithmName,otherParams, console.log(algorithmName+" "+otherParams);var graph=this.graph;var ignoreNodes={};if(ignoreSeparateNodes) for(var i=0;i=0;if(isMac) g_selectGroupText=document.getElementById("selectGroupMac").innerHTML;else -g_selectGroupText=document.getElementById("selectGroupWin").innerHTML;g_dragGroupText=document.getElementById("dragSelectedGroup").innerHTML;g_copyGroupeButton=document.getElementById("copySelectedGroup").innerHTML;g_removeGroupeButton=document.getElementById("removeSelectedGroup").innerHTML;g_BFSName=document.getElementById("BFSName").innerHTML;g_ColoringName=document.getElementById("ColoringName").innerHTML;g_findConnectedComponent=document.getElementById("findConnectedComponent").innerHTML;g_DFSName=document.getElementById("DFSName").innerHTML;g_EulerinLoopName=document.getElementById("EulerinLoopName").innerHTML;g_EulerinPath=document.getElementById("EulerinPath").innerHTML;g_FloidName=document.getElementById("FloidName").innerHTML;g_GraphReorder=document.getElementById("GraphReorder").innerHTML;g_HamiltoianCycleName=document.getElementById("HamiltoianCycleName").innerHTML;g_HamiltonianPath=document.getElementById("HamiltonianPath").innerHTML;g_MaxFlowName=document.getElementById("MaxFlowName").innerHTML;g_minimumSpanningTree=document.getElementById("minimumSpanningTree").innerHTML;g_modernGraphStyleName=document.getElementById("modernGraphStyleName").innerHTML;g_RadiusAndDiameter=document.getElementById("RadiusAndDiameter").innerHTML;g_findShortPathName=document.getElementById("findShortPathName").innerHTML;g_findShortPathBellmanFordName=document.getElementById("findShortPathBellmanFordName").innerHTML;g_VerticesDegreeName=document.getElementById("VerticesDegreeName").innerHTML;g_SpanningTreeResult=document.getElementById("MinSpanningTreeResult").innerHTML;g_SpanningTreeIgnoreDir=document.getElementById("MinSpanningIgnoreDir").innerHTML;g_SpanningTreeNotConnected=document.getElementById("MinSpanningNotConnected").innerHTML;g_selectFirstGraphIsomorphismCheck=document.getElementById("SelectFirstGraphIsomorphismCheck").innerHTML;g_selectSecondGraphIsomorphismCheck=document.getElementById("SelectSecondGraphIsomorphismCheck").innerHTML;g_selectFirstGraphPatternCheck=document.getElementById("SelectFirstGraphPatternCheck").innerHTML;g_selectSecondGraphForSearchSubgraph=document.getElementById("SelectSecondGraphForSearchSubgraph").innerHTML;g_graphsIsomorph=document.getElementById("GraphsIsomorph").innerHTML;g_graphsNotIsomorph=document.getElementById("GraphsNotIsomorph").innerHTML;g_numberOfIsomorphSubgraphIs=document.getElementById("NumberOfIsomorphSubgraphIs").innerHTML;g_graphHasNoIsomorphSubgraph=document.getElementById("GraphHasNoIsomorphSubgraph").innerHTML;g_searchIsomorphSubgraph=document.getElementById("SearchIsomorphSubgraph").innerHTML;g_subgraphNo=document.getElementById("SubgraphNo").innerHTML;g_graphHasNoAtleast2Graphs=document.getElementById("GraphHasNoAtleast2Graphs").innerHTML;g_IsomorphismCheck=document.getElementById("IsomorphismCheck").innerHTML;g_graphIsDisconnected=document.getElementById("GraphIsDisconnected").innerHTML;g_graphIsTrivial=document.getElementById("GraphIsTrivial").innerHTML;g_graphRadius=document.getElementById("GraphRadius").innerHTML;g_graphDiameter=document.getElementById("GraphDiameter").innerHTML;g_vertexCentral=document.getElementById("VertexCentral").innerHTML;g_vertexPeripheral=document.getElementById("VertexPeripheral").innerHTML;g_maximumDegreeOfGraph=document.getElementById("MaximumDegreeOfGraph").innerHTML;g_colorNumber=document.getElementById("ColorNumber").innerHTML;g_done=document.getElementById("Done").innerHTML;g_action=document.getElementById("ActionText").innerHTML;g_commonEdgeStyle=document.getElementById("CommonEdgeStyleText").innerHTML;g_selectedEdgeStyle=document.getElementById("SelectedEdgeStyleText").innerHTML;g_commonVertexStyle=document.getElementById("CommonVertexStyleText").innerHTML;g_selectedVertexStyle=document.getElementById("SelectedVertexStyleText").innerHTML;g_findAllPathes=document.getElementById("FindAllPathes").innerHTML;g_numberOfPathesFrom=document.getElementById("NumberOfPathesFrom").innerHTML;g_to=document.getElementById("To").innerHTML;g_are=document.getElementById("Are").innerHTML;g_pathN=document.getElementById("PathN").innerHTML;g_selectFinishVertex=document.getElementById("SelectFinishVertex").innerHTML;g_selectStartVertex=document.getElementById("SelectStartVertex").innerHTML;g_findAllPathesFromVertex=document.getElementById("findAllPathsFromVertex").innerHTML;g_distanceFrom=document.getElementById("distanceFrom").innerHTML;g_pathTo=document.getElementById("pathTo").innerHTML;g_useContextMenuText=document.getElementById("UseContextMenuText").innerHTML;g_findLongestPath=document.getElementById("findLongestPath").innerHTML;g_LengthOfLongestPathFrom=document.getElementById("LengthOfLongestPathFrom").innerHTML;g_additionalActions=document.getElementById("additionlActions").innerHTML;g_reverseAllEdges=document.getElementById("reverseAllEdges").innerHTML;g_makeAllUndirected=document.getElementById("makeAllUndirected").innerHTML;g_makeAllDirected=document.getElementById("makeAllDirected").innerHTML;g_pairWrongFormat=document.getElementById("pairWrongFormat").innerHTML;g_fix=document.getElementById("fixButton").innerHTML;g_reuseSavedEdge=document.getElementById("reuseSavedEdge").innerHTML;g_MaxClique=document.getElementById("maxClique").innerHTML;g_MaxCliqueNotFound=document.getElementById("maxCliqueNotFound").innerHTML;g_MaxCliqueSizeIs=document.getElementById("maxCliqueSizeIs").innerHTML;g_MaxCliqueContains=document.getElementById("maxCliqueContains").innerHTML;g_wrongImageFormatPNGAndJPEG=document.getElementById("wrongImageFormatPNGAndJPEG").innerHTML;g_wrongImageSizeP1=document.getElementById("wrongImageSizeP1").innerHTML;g_originalGraph=document.getElementById("originalGraph").innerHTML;g_autoSavedGraph=document.getElementById("autoSavedGraph").innerHTML;g_selectGraphToLoad=document.getElementById("selectGraphToLoad").innerHTML;g_vertexNamePlaceHolder=document.getElementById("vertexNamePlaceHolder").innerHTML;g_MaxIndependentSet=document.getElementById("maxIndependentSet").innerHTML;g_MaxIndependentSetNotFound=document.getElementById("maxIndependentSetNotFound").innerHTML;g_MaxIndependentSetSizeIs=document.getElementById("maxIndependentSetSizeIs").innerHTML;g_MaxIndependentSetContains=document.getElementById("maxIndependentSetContains").innerHTML;g_FindAllShortestPathes=document.getElementById("findAllShortestPathes").innerHTML;g_numberOfShortestPathesFrom=document.getElementById("numberOfShortestPathesFrom").innerHTML;g_length_is=document.getElementById("lengthIs").innerHTML;} +g_selectGroupText=document.getElementById("selectGroupWin").innerHTML;g_dragGroupText=document.getElementById("dragSelectedGroup").innerHTML;g_copyGroupeButton=document.getElementById("copySelectedGroup").innerHTML;g_removeGroupeButton=document.getElementById("removeSelectedGroup").innerHTML;g_BFSName=document.getElementById("BFSName").innerHTML;g_ColoringName=document.getElementById("ColoringName").innerHTML;g_findConnectedComponent=document.getElementById("findConnectedComponent").innerHTML;g_DFSName=document.getElementById("DFSName").innerHTML;g_EulerinLoopName=document.getElementById("EulerinLoopName").innerHTML;g_EulerinPath=document.getElementById("EulerinPath").innerHTML;g_FloidName=document.getElementById("FloidName").innerHTML;g_GraphReorder=document.getElementById("GraphReorder").innerHTML;g_HamiltoianCycleName=document.getElementById("HamiltoianCycleName").innerHTML;g_HamiltonianPath=document.getElementById("HamiltonianPath").innerHTML;g_MaxFlowName=document.getElementById("MaxFlowName").innerHTML;g_minimumSpanningTree=document.getElementById("minimumSpanningTree").innerHTML;g_modernGraphStyleName=document.getElementById("modernGraphStyleName").innerHTML;g_RadiusAndDiameter=document.getElementById("RadiusAndDiameter").innerHTML;g_findShortPathName=document.getElementById("findShortPathName").innerHTML;g_findShortPathBellmanFordName=document.getElementById("findShortPathBellmanFordName").innerHTML;g_VerticesDegreeName=document.getElementById("VerticesDegreeName").innerHTML;g_SpanningTreeResult=document.getElementById("MinSpanningTreeResult").innerHTML;g_SpanningTreeIgnoreDir=document.getElementById("MinSpanningIgnoreDir").innerHTML;g_SpanningTreeNotConnected=document.getElementById("MinSpanningNotConnected").innerHTML;g_selectFirstGraphIsomorphismCheck=document.getElementById("SelectFirstGraphIsomorphismCheck").innerHTML;g_selectSecondGraphIsomorphismCheck=document.getElementById("SelectSecondGraphIsomorphismCheck").innerHTML;g_selectFirstGraphPatternCheck=document.getElementById("SelectFirstGraphPatternCheck").innerHTML;g_selectSecondGraphForSearchSubgraph=document.getElementById("SelectSecondGraphForSearchSubgraph").innerHTML;g_graphsIsomorph=document.getElementById("GraphsIsomorph").innerHTML;g_graphsNotIsomorph=document.getElementById("GraphsNotIsomorph").innerHTML;g_numberOfIsomorphSubgraphIs=document.getElementById("NumberOfIsomorphSubgraphIs").innerHTML;g_graphHasNoIsomorphSubgraph=document.getElementById("GraphHasNoIsomorphSubgraph").innerHTML;g_searchIsomorphSubgraph=document.getElementById("SearchIsomorphSubgraph").innerHTML;g_subgraphNo=document.getElementById("SubgraphNo").innerHTML;g_graphHasNoAtleast2Graphs=document.getElementById("GraphHasNoAtleast2Graphs").innerHTML;g_IsomorphismCheck=document.getElementById("IsomorphismCheck").innerHTML;g_graphIsDisconnected=document.getElementById("GraphIsDisconnected").innerHTML;g_graphIsTrivial=document.getElementById("GraphIsTrivial").innerHTML;g_graphRadius=document.getElementById("GraphRadius").innerHTML;g_graphDiameter=document.getElementById("GraphDiameter").innerHTML;g_vertexCentral=document.getElementById("VertexCentral").innerHTML;g_vertexPeripheral=document.getElementById("VertexPeripheral").innerHTML;g_maximumDegreeOfGraph=document.getElementById("MaximumDegreeOfGraph").innerHTML;g_colorNumber=document.getElementById("ColorNumber").innerHTML;g_done=document.getElementById("Done").innerHTML;g_action=document.getElementById("ActionText").innerHTML;g_commonEdgeStyle=document.getElementById("CommonEdgeStyleText").innerHTML;g_selectedEdgeStyle=document.getElementById("SelectedEdgeStyleText").innerHTML;g_commonVertexStyle=document.getElementById("CommonVertexStyleText").innerHTML;g_selectedVertexStyle=document.getElementById("SelectedVertexStyleText").innerHTML;g_findAllPathes=document.getElementById("FindAllPathes").innerHTML;g_numberOfPathesFrom=document.getElementById("NumberOfPathesFrom").innerHTML;g_to=document.getElementById("To").innerHTML;g_are=document.getElementById("Are").innerHTML;g_pathN=document.getElementById("PathN").innerHTML;g_selectFinishVertex=document.getElementById("SelectFinishVertex").innerHTML;g_selectStartVertex=document.getElementById("SelectStartVertex").innerHTML;g_findAllPathesFromVertex=document.getElementById("findAllPathsFromVertex").innerHTML;g_distanceFrom=document.getElementById("distanceFrom").innerHTML;g_pathTo=document.getElementById("pathTo").innerHTML;g_useContextMenuText=document.getElementById("UseContextMenuText").innerHTML;g_findLongestPath=document.getElementById("findLongestPath").innerHTML;g_LengthOfLongestPathFrom=document.getElementById("LengthOfLongestPathFrom").innerHTML;g_additionalActions=document.getElementById("additionlActions").innerHTML;g_reverseAllEdges=document.getElementById("reverseAllEdges").innerHTML;g_makeAllUndirected=document.getElementById("makeAllUndirected").innerHTML;g_makeAllDirected=document.getElementById("makeAllDirected").innerHTML;g_pairWrongFormat=document.getElementById("pairWrongFormat").innerHTML;g_fix=document.getElementById("fixButton").innerHTML;g_reuseSavedEdge=document.getElementById("reuseSavedEdge").innerHTML;g_MaxClique=document.getElementById("maxClique").innerHTML;g_MaxCliqueNotFound=document.getElementById("maxCliqueNotFound").innerHTML;g_MaxCliqueSizeIs=document.getElementById("maxCliqueSizeIs").innerHTML;g_MaxCliqueContains=document.getElementById("maxCliqueContains").innerHTML;g_wrongImageFormatPNGAndJPEG=document.getElementById("wrongImageFormatPNGAndJPEG").innerHTML;g_wrongImageSizeP1=document.getElementById("wrongImageSizeP1").innerHTML;g_originalGraph=document.getElementById("originalGraph").innerHTML;g_autoSavedGraph=document.getElementById("autoSavedGraph").innerHTML;g_selectGraphToLoad=document.getElementById("selectGraphToLoad").innerHTML;g_vertexNamePlaceHolder=document.getElementById("vertexNamePlaceHolder").innerHTML;g_MaxIndependentSet=document.getElementById("maxIndependentSet").innerHTML;g_MaxIndependentSetNotFound=document.getElementById("maxIndependentSetNotFound").innerHTML;g_MaxIndependentSetSizeIs=document.getElementById("maxIndependentSetSizeIs").innerHTML;g_MaxIndependentSetContains=document.getElementById("maxIndependentSetContains").innerHTML;g_FindAllShortestPathes=document.getElementById("findAllShortestPathes").innerHTML;g_numberOfShortestPathesFrom=document.getElementById("numberOfShortestPathesFrom").innerHTML;g_length_is=document.getElementById("lengthIs").innerHTML;g_error=document.getElementById("error").innerHTML;} function UndoStack(maxUndoStackSize){this.undoStack=[];this.maxUndoStackSize=maxUndoStackSize;} UndoStack.prototype.PushToStack=function(actionName,dataToSave) {var object={};object.actionName=actionName;object.data=dataToSave;this.undoStack.push(object);while(this.undoStack.length>this.maxUndoStackSize) @@ -2232,7 +2238,13 @@ Editor.prototype.redraw=function(){this.application.redrawGraph();} Editor.prototype.createAlgorithmMenu=function() {let self=this;var algorithmBaseId="Algo";var algorithms=this.application.getAlgorithmNames();var index=0;for(var i=0;i";let warring_cond_end="";$("#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");};$("#graphMaxVerexLimit").dialog({resizable:false,title:g_error,width:400,modal:true,dialogClass:'EdgeDialog',buttons:dialogButtons,});}} var eventData={};eventData.index=i;eventData.object=clone;eventData.algorithm=algorithm;$("#openAlgorithmList").bind('click',eventData,function(_eventData){var data=_eventData.data;var algorithm=g_Algorithms[g_AlgorithmIds.indexOf(data.algorithm.id)](self.application.graph,self.application);if((self.application.graph.isMulti()&&!algorithm.IsSupportMultiGraph())||(self.application.graph.hasNegative()&&!algorithm.IsSupportNegativeWeight())) {$(data.object).hide();} else diff --git a/script/pages/editor/model/texts.js b/script/pages/editor/model/texts.js index be19979..16559bd 100644 --- a/script/pages/editor/model/texts.js +++ b/script/pages/editor/model/texts.js @@ -222,6 +222,8 @@ var g_FindAllShortestPathes = "Find all shortest paths"; var g_numberOfShortestPathesFrom = "Number of shortest paths from "; var g_length_is = "length is "; +var g_error = "Error"; + function loadTexts() { g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML; @@ -451,4 +453,6 @@ function loadTexts() g_FindAllShortestPathes = document.getElementById("findAllShortestPathes").innerHTML; g_numberOfShortestPathesFrom = document.getElementById("numberOfShortestPathesFrom").innerHTML; g_length_is = document.getElementById("lengthIs").innerHTML; + + g_error = document.getElementById("error").innerHTML; } \ No newline at end of file diff --git a/script/pages/editor/ui/editor.js b/script/pages/editor/ui/editor.js index b1af729..448168c 100644 --- a/script/pages/editor/ui/editor.js +++ b/script/pages/editor/ui/editor.js @@ -687,9 +687,41 @@ Editor.prototype.createAlgorithmMenu = function() { e["closeThisMenu"] = true; userAction(this.id); - self.restButtons (""); - self.application.SetHandler(new AlgorithmGraphHandler(self.application, - g_Algorithms[g_AlgorithmIds.indexOf(this.id)](self.application.graph, self.application))); + + let algorithm = 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 = ""; + let warring_cond_end = ""; + + $("#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 = {}; diff --git a/tpl/home.php b/tpl/home.php index 802676d..b3eabdc 100755 --- a/tpl/home.php +++ b/tpl/home.php @@ -481,16 +481,21 @@
-
+
-
+
-
+
+ +
+
+
+
@@ -991,6 +996,7 @@

+