diff --git a/core/config/main.php b/core/config/main.php index a9cc36b..b36c4bb 100755 --- a/core/config/main.php +++ b/core/config/main.php @@ -93,5 +93,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'] = 78; + $g_config['engine_version'] = 79; ?> diff --git a/script/entities/graph/model/Graph.js b/script/entities/graph/model/Graph.js index 9f9163c..7a1e5d4 100644 --- a/script/entities/graph/model/Graph.js +++ b/script/entities/graph/model/Graph.js @@ -234,7 +234,7 @@ Graph.prototype.FindEdgeMin = function(id1, id2) Graph.prototype.FindEdgeMax = function(id1, id2) { var res = null; - var maxWeight = 0; + var maxWeight = -this.infinity; for (var i = 0; i < this.edges.length; i++) { var edge = this.edges[i]; diff --git a/script/features/algorithms/model/plugins/FindLongestPath.js b/script/features/algorithms/model/plugins/FindLongestPath.js index 8ac3857..270e515 100644 --- a/script/features/algorithms/model/plugins/FindLongestPath.js +++ b/script/features/algorithms/model/plugins/FindLongestPath.js @@ -218,6 +218,10 @@ FindLongestPath.prototype.getPriority = function() return -9.4; } +FindLongestPath.prototype.IsSupportNegativeWeight = function() +{ + return true; +} // Factory for connected components. function CreateFindLongestPath(graph, app) diff --git a/script/features/algorithms/model/plugins/FindShortPatchsFromOne.js b/script/features/algorithms/model/plugins/FindShortPatchsFromOne.js index 6f725c1..97136b9 100644 --- a/script/features/algorithms/model/plugins/FindShortPatchsFromOne.js +++ b/script/features/algorithms/model/plugins/FindShortPatchsFromOne.js @@ -209,6 +209,11 @@ FindShortPatchsFromOne.prototype.IsSupportMultiGraph = function() return true; } +FindShortPatchsFromOne.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindShortPatchsFromOne(graph, app) { diff --git a/script/features/algorithms/model/plugins/MaxClique.js b/script/features/algorithms/model/plugins/MaxClique.js index 21b4389..46bed73 100644 --- a/script/features/algorithms/model/plugins/MaxClique.js +++ b/script/features/algorithms/model/plugins/MaxClique.js @@ -96,6 +96,11 @@ MaxClique.prototype.IsSupportNegativeWeight = function() return true; } +MaxClique.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + function CreateMaxClique(graph, app) { return new MaxClique(graph, app) diff --git a/script/features/algorithms/model/plugins/MaxFlow.js b/script/features/algorithms/model/plugins/MaxFlow.js index 500a3f9..f81d774 100644 --- a/script/features/algorithms/model/plugins/MaxFlow.js +++ b/script/features/algorithms/model/plugins/MaxFlow.js @@ -188,13 +188,13 @@ FindMaxFlow.prototype.getPriority = function() } // @return true, if you change resotry graph after use. -BaseAlgorithm.prototype.wantRestore = function() +FindMaxFlow.prototype.wantRestore = function() { return true; } // calls this method if wantRestore return true. -BaseAlgorithm.prototype.restore = function() +FindMaxFlow.prototype.restore = function() { if (this.selectedEdges != null) { @@ -216,6 +216,11 @@ BaseAlgorithm.prototype.restore = function() } } +FindMaxFlow.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindMaxFlow(graph, app) diff --git a/script/features/algorithms/model/plugins/MinimumSpanningTree.js b/script/features/algorithms/model/plugins/MinimumSpanningTree.js index 4ce9a6b..19c8393 100644 --- a/script/features/algorithms/model/plugins/MinimumSpanningTree.js +++ b/script/features/algorithms/model/plugins/MinimumSpanningTree.js @@ -155,6 +155,10 @@ MinimumSpanningTree.prototype.IsSupportMultiGraph = function () return true; } +MinimumSpanningTree.prototype.IsSupportNegativeWeight = function() +{ + return true; +} // Factory for algorithm. function CreateMinimumSpanningTree(graph, app) diff --git a/script/features/algorithms/model/plugins/ShortestPath.js b/script/features/algorithms/model/plugins/ShortestPath.js index 99dcb37..bfcaf5c 100644 --- a/script/features/algorithms/model/plugins/ShortestPath.js +++ b/script/features/algorithms/model/plugins/ShortestPath.js @@ -221,6 +221,11 @@ FindShortPathNew.prototype.IsSupportMultiGraph = function () return true; } +FindShortPathNew.prototype.IsSupportNegativeWeight = function() +{ + return true; +} + // Factory for connected components. function CreateFindShortPathNew(graph, app) diff --git a/script/features/graphoffline/Graphoffline.Emscripten.wasm b/script/features/graphoffline/Graphoffline.Emscripten.wasm index a2c1a34..12d16e6 100644 Binary files a/script/features/graphoffline/Graphoffline.Emscripten.wasm and b/script/features/graphoffline/Graphoffline.Emscripten.wasm differ diff --git a/script/pages/editor/api/index.js.cache b/script/pages/editor/api/index.js.cache index e845174..88c8a98 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=75","/script/entities/graph/api/index.js?v=75","/script/shared/point.js?v=75","/script/entities/edge/api/index.js?v=75","/script/entities/edge/model/BaseEdge.js?v=75","/script/entities/edge/model/EdgeModel.js?v=75","/script/entities/vertex/api/index.js?v=75","/script/entities/vertex/model/BaseVertex.js?v=75","/script/entities/vertex/model/VertexModel.js?v=75","/script/entities/graph/model/Graph.js?v=75","/script/features/draw_graph/api/index.js?v=75","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=75","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=75","/script/features/draw_graph/model/BaseVertexDrawer.js?v=75","/script/features/algorithms/api/index.js?v=75","/script/features/algorithms/model/Algorithms.js?v=75","/script/features/algorithms/model/BaseTraversal.js?v=75","/script/features/base_handler/index.js?v=75","/script/features/default_handler/index.js?v=75","/script/features/add_vertices_handler/index.js?v=75","/script/features/connect_vertices_handler/index.js?v=75","/script/features/delete_objects_handler/index.js?v=75","/script/features/algorithm_handler/index.js?v=75","/script/features/serialization/api/index.js?v=75","/script/features/serialization/model/GraphMLCreator.js?v=75","/script/features/enum_vertices/EnumVertices.js?v=75","/script/pages/editor/model/texts.js?v=75","/script/pages/editor/model/UndoStack.js?v=75","/script/pages/editor/model/DiskSaveLoad.js?v=75","/script/pages/editor/model/Application.js?v=75","/script/pages/editor/ui/ya_metrika.js?v=75","/script/pages/editor/ui/editor.js?v=75","/script/pages/editor/ui/main.js?v=75",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.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=76","/script/entities/graph/api/index.js?v=76","/script/shared/point.js?v=76","/script/entities/edge/api/index.js?v=76","/script/entities/edge/model/BaseEdge.js?v=76","/script/entities/edge/model/EdgeModel.js?v=76","/script/entities/vertex/api/index.js?v=76","/script/entities/vertex/model/BaseVertex.js?v=76","/script/entities/vertex/model/VertexModel.js?v=76","/script/entities/graph/model/Graph.js?v=76","/script/features/draw_graph/api/index.js?v=76","/script/features/draw_graph/model/BaseBackgroundDrawer.js?v=76","/script/features/draw_graph/model/BaseEdgeDrawer.js?v=76","/script/features/draw_graph/model/BaseVertexDrawer.js?v=76","/script/features/algorithms/api/index.js?v=76","/script/features/algorithms/model/Algorithms.js?v=76","/script/features/algorithms/model/BaseTraversal.js?v=76","/script/features/base_handler/index.js?v=76","/script/features/default_handler/index.js?v=76","/script/features/add_vertices_handler/index.js?v=76","/script/features/connect_vertices_handler/index.js?v=76","/script/features/delete_objects_handler/index.js?v=76","/script/features/algorithm_handler/index.js?v=76","/script/features/serialization/api/index.js?v=76","/script/features/serialization/model/GraphMLCreator.js?v=76","/script/features/enum_vertices/EnumVertices.js?v=76","/script/pages/editor/model/texts.js?v=76","/script/pages/editor/model/UndoStack.js?v=76","/script/pages/editor/model/DiskSaveLoad.js?v=76","/script/pages/editor/model/Application.js?v=76","/script/pages/editor/ui/ya_metrika.js?v=76","/script/pages/editor/ui/editor.js?v=76","/script/pages/editor/ui/main.js?v=76",]);{function onloadEditor(){console.log("onload() call");doIncludeAsync([include("shared/canvas2svg.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("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/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') @@ -291,7 +291,7 @@ Graph.prototype.FindEdgeMin=function(id1,id2) {res=edge;minWeight=edge.weight;}}} return res;} Graph.prototype.FindEdgeMax=function(id1,id2) -{var res=null;var maxWeight=0;for(var i=0;imaxWeight) {res=edge;maxWeight=edge.weight;}}} @@ -2018,4 +2018,4 @@ function postLoadPage() $(document).ready(function() {window.onresize=function(event) {resizeCanvas();} -document.getElementById('canvas').addEventListener("touchstart",touchHandler,true);document.getElementById('canvas').addEventListener("touchmove",touchHandler,true);document.getElementById('canvas').addEventListener("touchend",touchHandler,true);document.getElementById('canvas').addEventListener("touchcancel",touchHandler,true);var isMobile=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i);if(!isMobile&&!DisableEmscripten){let fullPathToGraphffoline="features/graphoffline/Graphoffline.Emscripten.js";doIncludeAsync([include(fullPathToGraphffoline),],()=>{Module['onRuntimeInitialized']=onRuntimeInitialized;var process=Module.cwrap('ProcessAlgorithm','string',['string']);function onRuntimeInitialized(){editor.application.setEmscripten(process);}})}});moduleLoader.endCacheLoading(); \ No newline at end of file +document.getElementById('canvas').addEventListener("touchstart",touchHandler,true);document.getElementById('canvas').addEventListener("touchmove",touchHandler,true);document.getElementById('canvas').addEventListener("touchend",touchHandler,true);document.getElementById('canvas').addEventListener("touchcancel",touchHandler,true);var isMobile=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i);if(!isMobile&&!DisableEmscripten){let fullPathToGraphffoline="features/graphoffline/Graphoffline.Emscripten.js"+"?v="+globalVersion;doIncludeAsync([include(fullPathToGraphffoline),],()=>{Module['onRuntimeInitialized']=onRuntimeInitialized;var process=Module.cwrap('ProcessAlgorithm','string',['string']);function onRuntimeInitialized(){editor.application.setEmscripten(process);}})}});moduleLoader.endCacheLoading(); \ No newline at end of file diff --git a/script/pages/editor/ui/main.js b/script/pages/editor/ui/main.js index 7f20628..07477bf 100644 --- a/script/pages/editor/ui/main.js +++ b/script/pages/editor/ui/main.js @@ -82,7 +82,7 @@ $(document).ready(function () // Try load emscripten implementation var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i); if (!isMobile && !DisableEmscripten) { - let fullPathToGraphffoline = "features/graphoffline/Graphoffline.Emscripten.js"; + let fullPathToGraphffoline = "features/graphoffline/Graphoffline.Emscripten.js" + "?v=" + globalVersion; doIncludeAsync ([ include (fullPathToGraphffoline), ], () => { diff --git a/script/shared/loader.js b/script/shared/loader.js index 64a218d..973d7e8 100644 --- a/script/shared/loader.js +++ b/script/shared/loader.js @@ -1,5 +1,5 @@ // Global version needs to force reload scripts from server. -let globalVersion = 75; +let globalVersion = 76; var include = function(filename, localDir) { return {filename: filename, localDir: localDir};