Update algorithm limits and error handling

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

No files matched your search

+21 -14
View File
@@ -152,6 +152,17 @@ BaseAlgorithm.prototype.IsSupportNegativeWeight = function()
return false;
}
// Limit by number of vertexes for the algorithm.
BaseAlgorithm.prototype.MaxGraphSize = function()
{
return 1000;
}
BaseAlgorithm.prototype.MaxEgdeNumber = function()
{
return 10000;
}
/**
* Default handler.
* Select using mouse, drag.
@@ -218,20 +229,16 @@ BaseAlgorithmEx.prototype.CalculateAlgorithm = function(algorithmName, otherPara
var $xml = $( xmlDoc );
$results = $xml.find( "result" );
$results.each(function(){
$values = $(this).find( "value" );
$values.each(function(){
var type = $(this).attr('type');
var value = $(this).text();
var res = {};
res.type = type;
res.value = value;
result.push(res);
});
});
// Use native because jqueary hangs for results with 10000+ nodes.
let values = $results[0].getElementsByTagName("value");
for (var j = 0; j < values.length; j++)
{
var type = values[j].getAttribute('type');
var value = values[j].textContent;
result.push({ type: type, value: value });
}
$nodes = $xml.find( "node" );
$nodes.each(function(){
@@ -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); };
@@ -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); };
@@ -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)
@@ -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)
@@ -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)
@@ -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); };
@@ -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); };
@@ -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;
@@ -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()
@@ -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()
@@ -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()
+17 -5
View File
@@ -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<graph.vertices.length;i++)
if(!graph.HasConnectedNodes(graph.vertices[i]))
ignoreNodes[graph.vertices[i].id]=1;var creator=new GraphMLCreator(graph.vertices,graph.edges,ignoreNodes);var pathObjects=[];var properties={};var result=[];var xml=creator.GetXMLString();console.log(xml);var processResult=function(msg){console.log(msg);$('#debug').text(msg);xmlDoc=$.parseXML(msg);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);});});$nodes=$xml.find("node");$nodes.each(function(){var id=$(this).attr('id');$data=$(this).find("data");$data.each(function(){if("hightlightNode"==$(this).attr('key')&&$(this).text()=="1")
ignoreNodes[graph.vertices[i].id]=1;var creator=new GraphMLCreator(graph.vertices,graph.edges,ignoreNodes);var pathObjects=[];var properties={};var result=[];var xml=creator.GetXMLString();console.log(xml);var processResult=function(msg){console.log(msg);$('#debug').text(msg);xmlDoc=$.parseXML(msg);var $xml=$(xmlDoc);$results=$xml.find("result");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(){var id=$(this).attr('id');$data=$(this).find("data");$data.each(function(){if("hightlightNode"==$(this).attr('key')&&$(this).text()=="1")
{pathObjects.push(graph.FindVertex(id));}
else
{if(!properties[id])
@@ -1468,10 +1474,10 @@ TextEnumVerticesCustom.prototype.ShowDialog=function(callback,buttonText,titleTi
var g_textsSelectAndMove="Drag objects";var g_moveCursorForMoving="Move cursor";var g_clickToAddVertex="Click to add vertex";var g_selectFirstVertexToConnect="Select first vertex to connect";var g_selectSecondVertexToConnect="Select second vertex to connect";var g_selectStartVertexForShortPath="Select start vertex for shortest path";var g_selectFinishVertexForShortPath="Select finish vertex for shortest path";var g_shortestPathResult="Shortest path is %d";var g_pathNotExists="Path does not exists";var g_selectObjectToDelete="Select object to delete";var g_addEdge="Add edge";var g_orintEdge="Directed";var g_notOrintEdge="Undirected";var g_adjacencyMatrixText="Adjacency Matrix";var g_save="Save";var g_cancel="Cancel";var g_save_graph="Save Graph";var g_shortestDistance="lowest-distance is ";var g_incidenceMatrixText="Incidence Matrix";var g_save_dialog="Save dialog";var g_close="close";var g_sickConnectedComponent="Sick connected component is ";var g_connectedComponent="Connected component is ";var g_what_do_you_think="What do you think about site?";var g_name="Name";var g_feedback="Feedback";var g_send="Send";var g_write_to_us="Write to us";var g_fixMatrix="Fix matrix";var g_readMatrixHelp="Matrix format help";var g_matrixWrongFormat="Matrix is wrong";var g_pairWrongFormat="Edge List is wrong";var g_fix="Fix"
var g_save_image_dialog="Save graph image";var g_fullReport="Full report";var g_shortReport="Short report";var g_hasEulerianLoop="Graph has Eulerian Loop";var g_hasNotEulerianLoop="Graph has not Eulerian Loop";var g_hasEulerianPath="Graph has Eulerian Path";var g_hasNotEulerianPath="Graph has not Eulerian Path";var g_processing="Processing...";var g_customEnumVertex="Custom";var g_addVertex="Add vertex";var g_renameVertex="Rename vertex";var g_rename="Rename";var g_language="en";var g_editWeight="Edit weight";var g_noWeight="No weight";var g_groupRename="Group rename";var g_vote="Vote";var g_recommendAlgorithm="Recommend algorithm";var g_graphOfMinDist="Graph of minimal distances.";var g_checkToSave="Check to save";var g_showDistMatrix="Show Distance matrix";var g_minDistMatrixText="Minimal distances matrix";var g_selectStartVertexForMaxFlow="Select source vertex for max flow";var g_selectFinishVertexForMaxFlow="Select sink vertex for max flow";var g_maxFlowResult="Maximum flow from %2 to %3 is %1";var g_flowNotExists="Flow from %1 to %2 does not exists";var g_sourceVertex="Source";var g_sinkVertex="Sink";var g_hasHamiltonianLoop="Graph has Hamiltonian Loop";var g_hasNotHamiltonianLoop="Graph has not Hamiltonian Loop";var g_hasHamiltonianPath="Graph has Hamiltonian Path";var g_hasNotHamiltonianPath="Graph has not Hamiltonian Path";var g_startTraversal="Select start traversal vector";var g_traversalOrder="Traversal order: ";var g_curveEdge="Curved edge";var g_Undo="Undo";var g_default="default";var g_vertexDraw="Vertex draw style";var g_edgeDraw="Edge draw style";var g_backgroundStyle="Background style";var g_GraphIsMultiMessage="Graph is multigraph";var g_GraphIsGeneralMessage="";var g_DefaultWeightPreset="no weight";var g_dragGroupText="Drag group.";var g_selectGroupText="Select using ctrl";var g_copyGroupeButton="Duplicate";var g_removeGroupeButton="Remove objects";var g_BFSName="Breadth-first search";var g_ColoringName="Graph coloring";var g_findConnectedComponent="Find connected components";var g_DFSName="Depth-first search";var g_EulerinLoopName="Find Eulerian cycle";var g_EulerinPath="Find Eulerian path";var g_FloidName="Floyd–Warshall algorithm";var g_GraphReorder="Arrange the graph";var g_HamiltoianCycleName="Find Hamiltonian cycle";var g_HamiltonianPath="Find Hamiltonian path";var g_MaxFlowName="Find Maximum flow";var g_minimumSpanningTree="Search of minimum spanning tree";var g_modernGraphStyleName="Visualization based on weight";var g_RadiusAndDiameter="Search graph radius and diameter";var g_findShortPathName="Find shortest path using Dijkstra's algorithm";var g_findShortPathBellmanFordName="Find shortest path using Bellman–Ford algorithm";var g_VerticesDegreeName="Calculate vertices degree";var g_SpanningTreeResult="Min Spanning Tree is";var g_SpanningTreeIgnoreDir="We ignored edges direction for calculation";var g_SpanningTreeNotConnected="Graph is not connected";var g_selectFirstGraphIsomorphismCheck="Select first graph for isomorphic check. Click to any node of graph";var g_selectSecondGraphIsomorphismCheck="Select second graph for isomorphic check. Click to any node of graph";var g_selectFirstGraphPatternCheck="Select a template graph by clicking to any node of graph";var g_selectSecondGraphForSearchSubgraph="Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";var g_graphsIsomorph="Graphs are isomorphic";var g_graphsNotIsomorph="Graphs are not isomorphic";var g_numberOfIsomorphSubgraphIs="Number of isomorphic subgraphs are ";var g_graphHasNoIsomorphSubgraph="Graph don't contain isomorphic subgraphs";var g_searchIsomorphSubgraph="Search isomorphic subgraphs";var g_subgraphNo="Isomorphic subgraph # ";var g_graphHasNoAtleast2Graphs="To use the algorithm, you need to create 2 separate graphs";var g_IsomorphismCheck="Check Graphs Isomorphism";var g_graphIsDisconnected="Graph is disconnected";var g_graphIsTrivial="Graph contains only one vertex";var g_graphRadius="Graph radius";var g_graphDiameter="Graph diameter";var g_vertexCentral="Central";var g_vertexPeripheral="Peripheral";var g_maximumDegreeOfGraph="The maximum degree of a graph is";var g_colorNumber="Color number is";var g_done="Done";var g_action="Action";var g_commonEdgeStyle="Common Edge Style";var g_selectedEdgeStyle="Selected Edge Style";var g_commonVertexStyle="Common Vertex Style";var g_selectedVertexStyle="Selected Vertex Style";var g_findAllPathes="Find all paths";var g_numberOfPathesFrom="Number of paths from "
var g_to=" to ";var g_are=" are ";var g_pathN="Path #";var g_selectFinishVertex="Select finish vertex";var g_selectStartVertex="Select start vertex";var g_findAllPathesFromVertex="Find all shortest paths from vertex";var g_distanceFrom="Distance from ";var g_pathTo="Path to ";var g_useContextMenuText="Use context menu for addition actions."
var g_findLongestPath="Find the longest path";var g_LengthOfLongestPathFrom="Length of the longest path from ";var g_additionalActions="Additional actions";var g_reverseAllEdges="Reverse all edges";var g_makeAllUndirected="Make all edges undirected";var g_makeAllDirected="Make all edges directed";var g_reuseSavedEdge="Reuse saved edge";var g_MaxClique="Max Clique";var g_MaxCliqueNotFound="Max Clique is not found";var g_MaxCliqueSizeIs="Max Clique size is ";var g_MaxCliqueContains=". Clique contains these vertecies: ";var g_wrongImageFormatPNGAndJPEG="Wrong image format. We support only JPEG and PNG.";var g_wrongImageSizeP1="Image size is too big. Image size must be less than {0} pixels.";var g_originalGraph="Original graph";var g_autoSavedGraph="Autosaved graph";var g_selectGraphToLoad="Would you like to load original graph or autosaved graph?";var g_vertexNamePlaceHolder="vertex name";var g_MaxIndependentSet="Max Independent Set";var g_MaxIndependentSetNotFound="Max Independent Set is not found";var g_MaxIndependentSetSizeIs="Max Independent Set size is ";var g_MaxIndependentSetContains=". Set contains these vertecies: ";var g_FindAllShortestPathes="Find all shortest paths";var g_numberOfShortestPathesFrom="Number of shortest paths from ";var g_length_is="length is ";function loadTexts()
var g_findLongestPath="Find the longest path";var g_LengthOfLongestPathFrom="Length of the longest path from ";var g_additionalActions="Additional actions";var g_reverseAllEdges="Reverse all edges";var g_makeAllUndirected="Make all edges undirected";var g_makeAllDirected="Make all edges directed";var g_reuseSavedEdge="Reuse saved edge";var g_MaxClique="Max Clique";var g_MaxCliqueNotFound="Max Clique is not found";var g_MaxCliqueSizeIs="Max Clique size is ";var g_MaxCliqueContains=". Clique contains these vertecies: ";var g_wrongImageFormatPNGAndJPEG="Wrong image format. We support only JPEG and PNG.";var g_wrongImageSizeP1="Image size is too big. Image size must be less than {0} pixels.";var g_originalGraph="Original graph";var g_autoSavedGraph="Autosaved graph";var g_selectGraphToLoad="Would you like to load original graph or autosaved graph?";var g_vertexNamePlaceHolder="vertex name";var g_MaxIndependentSet="Max Independent Set";var g_MaxIndependentSetNotFound="Max Independent Set is not found";var g_MaxIndependentSetSizeIs="Max Independent Set size is ";var g_MaxIndependentSetContains=". Set contains these vertecies: ";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;g_moveCursorForMoving=document.getElementById("MoveCursorForMoving").innerHTML;g_clickToAddVertex=document.getElementById("clickToAddVertex").innerHTML;g_selectFirstVertexToConnect=document.getElementById("selectFisrtVertextToConnect").innerHTML;g_selectSecondVertexToConnect=document.getElementById("selectSecondVertextToConnect").innerHTML;g_selectStartVertexForShortPath=document.getElementById("selectStartShortPathVertex").innerHTML;g_selectFinishVertexForShortPath=document.getElementById("selectFinishShortPathVertex").innerHTML;g_shortestPathResult=document.getElementById("shortPathResult").innerHTML;g_pathNotExists=document.getElementById("pathNotExists").innerHTML;g_selectObjectToDelete=document.getElementById("selectObjectToDelete").innerHTML;g_addEdge=document.getElementById("AddEdge").innerHTML;g_orintEdge=document.getElementById("OrintEdge").innerHTML;g_notOrintEdge=document.getElementById("NotOrintdge").innerHTML;g_adjacencyMatrixText=document.getElementById("AdjacencyMatrixText").innerHTML;g_save=document.getElementById("Save").innerHTML;g_cancel=document.getElementById("Cancel").innerHTML;g_shortestDistance=document.getElementById("shortestDist").innerHTML;g_incidenceMatrixText=document.getElementById("IncidenceMatrixText").innerHTML;g_save_dialog=document.getElementById("saveDialogTitle").innerHTML;g_close=document.getElementById("closeButton").innerHTML;g_sickConnectedComponent=document.getElementById("sickConnectedComponentResult").innerHTML;g_connectedComponent=document.getElementById("connectedComponentResult").innerHTML;g_what_do_you_think=document.getElementById("whatDoYouThink").innerHTML;g_name=document.getElementById("name").innerHTML;g_feedback=document.getElementById("feedback").innerHTML;g_send=document.getElementById("send").innerHTML;g_write_to_us=document.getElementById("writeToUs").innerHTML;g_fixMatrix=document.getElementById("fixMatrixButton").innerHTML;g_readMatrixHelp=document.getElementById("matrixHelp").innerHTML;g_matrixWrongFormat=document.getElementById("wronMatrixTitle").innerHTML;g_save_image_dialog=document.getElementById("saveImageDialogTitle").innerHTML;g_fullReport=document.getElementById("fullReport").innerHTML;g_shortReport=document.getElementById("shortReport").innerHTML;g_hasEulerianLoop=document.getElementById("hasEulerianLoop").innerHTML;g_hasNotEulerianLoop=document.getElementById("hasNotEulerianLoop").innerHTML;g_processing=document.getElementById("processing").innerHTML;g_customEnumVertex=document.getElementById("customEnumVertex").innerHTML;g_addVertex=document.getElementById("addVertexText").innerHTML;g_renameVertex=document.getElementById("renameVertex").innerHTML;g_rename=document.getElementById("renameText").innerHTML;g_language=document.getElementById("currentLanguage").innerHTML;g_editWeight=document.getElementById("editWeight").innerHTML;g_noWeight=document.getElementById("noWeight").innerHTML;g_groupRename=document.getElementById("groupeRenameText").innerHTML;g_vote=document.getElementById("voteText").innerHTML;g_recommendAlgorithm=document.getElementById("recommend_algorithm").innerHTML;g_hasEulerianPath=document.getElementById("hasEulerianPath").innerHTML;g_hasNotEulerianPath=document.getElementById("hasNotEulerianPath").innerHTML;g_graphOfMinDist=document.getElementById("graphOfMinDist").innerHTML;g_checkToSave=document.getElementById("checkToSave").innerHTML;g_showDistMatrix=document.getElementById("showDistMatrix").innerHTML;g_minDistMatrixText=document.getElementById("distMatrixText").innerHTML;g_selectStartVertexForMaxFlow=document.getElementById("selectStartVertexForMaxFlow").innerHTML;g_selectFinishVertexForMaxFlow=document.getElementById("selectFinishVertexForMaxFlow").innerHTML;g_maxFlowResult=document.getElementById("maxFlowResult").innerHTML;g_flowNotExists=document.getElementById("flowNotExists").innerHTML;g_sourceVertex=document.getElementById("sourceVertex").innerHTML;g_sinkVertex=document.getElementById("sinkVertex").innerHTML;g_hasHamiltonianLoop=document.getElementById("hasHamiltonianLoop").innerHTML;g_hasNotHamiltonianLoop=document.getElementById("hasNotHamiltonianLoop").innerHTML;g_hasHamiltonianPath=document.getElementById("hasHamiltonianPath").innerHTML;g_hasNotHamiltonianPath=document.getElementById("hasNotHamiltonianPath").innerHTML;g_startTraversal=document.getElementById("startTraversal").innerHTML;g_traversalOrder=document.getElementById("traversalOrder").innerHTML;g_curveEdge=document.getElementById("curveEdge").innerHTML;g_Undo=document.getElementById("undoTranslate").innerHTML;g_save_graph=document.getElementById("saveGraph").innerHTML;g_default=document.getElementById("default").innerHTML;g_vertexDraw=document.getElementById("vertexDrawStyle").innerHTML;g_edgeDraw=document.getElementById("edgeDrawStyle").innerHTML;g_backgroundStyle=document.getElementById("backgroundStyle").innerHTML;g_GraphIsMultiMessage=document.getElementById("graphIsLine truncated
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.getElLine truncated
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.getElLine truncated
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<algorithms.length;i++)
{algorithm=algorithms[i];var list=document.getElementById("algorithmCategoryElements"+algorithm.category);var item=document.getElementById("algTopic"+algorithm.category);var clone=item.cloneNode(true);var button=clone.getElementsByTagName("a")[0];var textSpan=button.getElementsByTagName("span")[1];button.id=algorithm.id;textSpan.innerHTML=algorithm.name;clone.style.display="block";button.onclick=function(e)
{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)));}
{e["closeThisMenu"]=true;userAction(this.id);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="<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");};$("#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
+4
View File
@@ -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;
}
+35 -3
View File
@@ -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 = "<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 = {};