Add Max Independent Set algorithm.

This commit is contained in:
Oleg Sh 2025-08-09 13:53:31 +02:00
parent 2bc0bda130
commit a5120569f3
26 changed files with 201 additions and 40 deletions

View File

@ -1,25 +0,0 @@
<?php
$tempFilename = "../tmp/pluginsList.txt";
if (isset($_GET["reset"]))
{
unlink($tempFilename);
}
$res = "";
if (!file_exists($tempFilename))
{
$jsScripts = glob("../script/plugins/*.js");
$res = json_encode($jsScripts);
file_put_contents ($tempFilename, $res);
}
else
{
$res = file_get_contents($tempFilename);
}
echo $res;
?>

View File

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

View File

@ -317,4 +317,14 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_clique"] = "Max Clique";
$g_lang["max_clique_not_found"] = "Max Clique is not found";
$g_lang["max_clique_size_is"] = "Max Clique size is ";
$g_lang["max_clique_contains"] = ". Clique contains these vertecies: ";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -319,4 +319,14 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_clique"] = "Max Clique";
$g_lang["max_clique_not_found"] = "Max Clique is not found";
$g_lang["max_clique_size_is"] = "Max Clique size is ";
$g_lang["max_clique_contains"] = ". Clique contains these vertecies: ";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -323,4 +323,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -281,4 +281,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_clique"] = "Max Clique";
$g_lang["max_clique_not_found"] = "Max Clique is not found";
$g_lang["max_clique_size_is"] = "Max Clique size is ";
$g_lang["max_clique_contains"] = ". Clique contains these vertecies: ";
?> ?>

View File

@ -320,4 +320,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_clique"] = "Max Clique";
$g_lang["max_clique_not_found"] = "Max Clique is not found";
$g_lang["max_clique_size_is"] = "Max Clique size is ";
$g_lang["max_clique_contains"] = ". Clique contains these vertecies: ";
?> ?>

View File

@ -325,4 +325,9 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -324,4 +324,9 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -291,4 +291,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -288,4 +288,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -324,4 +324,9 @@ Dodaliśmy polskie tłumaczenie, Patryk</a>";
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -289,4 +289,9 @@
$g_lang['open_last_used_graph'] = "Open Recent Graph"; $g_lang['open_last_used_graph'] = "Open Recent Graph";
$g_lang['vertex_name_place_holder'] = "vertex name"; $g_lang['vertex_name_place_holder'] = "vertex name";
$g_lang["max_independent_set"] = "Max Independent Set";
$g_lang["max_independent_set_not_found"] = "Max Independent Set is not found";
$g_lang["max_independent_set_size_is"] = "Max Independent Set size is ";
$g_lang["max_independent_set_contains"] = ". Set contains these vertecies: ";
?> ?>

View File

@ -329,4 +329,9 @@
$g_lang['open_last_used_graph'] = "Открыть недавний граф"; $g_lang['open_last_used_graph'] = "Открыть недавний граф";
$g_lang['vertex_name_place_holder'] = "вершина"; $g_lang['vertex_name_place_holder'] = "вершина";
$g_lang["max_independent_set"] = "Максимальное независимое множество";
$g_lang["max_independent_set_not_found"] = "Максимальное независимое множество не найдена";
$g_lang["max_independent_set_size_is"] = "Размер Максимального независимого множества равен ";
$g_lang["max_independent_set_contains"] = ". Множества содержит следующие вершины: ";
?> ?>

View File

@ -327,4 +327,9 @@
$g_lang['open_last_used_graph'] = "Відкрити нещодавній граф"; $g_lang['open_last_used_graph'] = "Відкрити нещодавній граф";
$g_lang['vertex_name_place_holder'] = "вершина"; $g_lang['vertex_name_place_holder'] = "вершина";
$g_lang["max_independent_set"] = "Максимальное независимое множество";
$g_lang["max_independent_set_not_found"] = "Максимальное независимое множество не найдена";
$g_lang["max_independent_set_size_is"] = "Размер Максимального независимого множества равен ";
$g_lang["max_independent_set_contains"] = ". Множества содержит следующие вершины: ";
?> ?>

View File

@ -28,7 +28,8 @@ function loadAsyncAlgorithms(onFinish) {
"ModernGraphStyle.js", "ModernGraphStyle.js",
"RadiusAndDiameter.js", "RadiusAndDiameter.js",
"ShortestPath.js", "ShortestPath.js",
"VerticesDegree.js"]; "VerticesDegree.js",
"MaxIndependentSet.js"];
doIncludeAsync (pluginsList.map((plugin) => include ("model/plugins/" + plugin, modulDir)), onFinish); doIncludeAsync (pluginsList.map((plugin) => include ("model/plugins/" + plugin, modulDir)), onFinish);
} }

View File

@ -96,11 +96,6 @@ MaxClique.prototype.IsSupportNegativeWeight = function()
return true; return true;
} }
MaxClique.prototype.IsSupportNegativeWeight = function()
{
return true;
}
function CreateMaxClique(graph, app) function CreateMaxClique(graph, app)
{ {
return new MaxClique(graph, app) return new MaxClique(graph, app)

View File

@ -0,0 +1,100 @@
/**
* Find Eulerian Loop.
*
*/
function MaxIndependentSet(graph, app)
{
BaseAlgorithmEx.apply(this, arguments);
this.message = g_processing;
this.selectedObjects = [];
}
// inheritance.
MaxIndependentSet.prototype = Object.create(BaseAlgorithmEx.prototype);
MaxIndependentSet.prototype.getName = function(local)
{
return g_MaxIndependentSet;
}
MaxIndependentSet.prototype.getId = function()
{
return "AbdallaE.MaxIndependentSet";
}
// @return message for user.
MaxIndependentSet.prototype.getMessage = function(local)
{
return this.message;
}
MaxIndependentSet.prototype.result = function(resultCallback)
{
this.outResultCallback = function (result ) { resultCallback(result); };
self = this;
this.CalculateAlgorithm("mis", [], function (pathObjects, properties, results)
{
self.resultCallback(pathObjects, properties, results);
});
return true;
}
MaxIndependentSet.prototype.resultCallback = function(pathObjects, properties, results)
{
result = results.length > 0 && results[0].value > 0 && results[0].type == 1;
var outputResult = {};
outputResult["version"] = 1;
this.message = result > 0 ? "" : g_MaxIndependentSetNotFound;
if (result > 0)
{
let size = results[0].value;
this.message = g_MaxIndependentSetSizeIs + size;
this.selectedObjects = [];
this.message = this.message + g_MaxIndependentSetContains;
var vertexIndex = 0;
for (var i = 1; i < results.length; i++)
{
let objectId = results[i].value;
if (results[i].type == 8)
{
let mainText = this.graph.FindVertex(objectId).mainText;
this.message = this.message + mainText + ((vertexIndex < size - 1) ? ", " : ".");
vertexIndex++;
}
this.selectedObjects[objectId] = 1;
}
}
this.outResultCallback(outputResult);
}
MaxIndependentSet.prototype.getObjectSelectedGroup = function(object)
{
return (object.id in this.selectedObjects) ? this.selectedObjects[object.id] : 0;
}
MaxIndependentSet.prototype.getPriority = function()
{
return -5;
}
MaxIndependentSet.prototype.IsSupportNegativeWeight = function()
{
return true;
}
function CreateMaxIndependentSet(graph, app)
{
return new MaxIndependentSet(graph, app)
}
// Gerister connected component.
RegisterAlgorithm (CreateMaxIndependentSet);

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -213,6 +213,11 @@ var g_selectGraphToLoad = "Would you like to load original graph or autosaved gr
var g_vertexNamePlaceHolder = "vertex name"; 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: ";
function loadTexts() function loadTexts()
{ {
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML; g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
@ -433,4 +438,9 @@ function loadTexts()
g_autoSavedGraph = document.getElementById("autoSavedGraph").innerHTML; g_autoSavedGraph = document.getElementById("autoSavedGraph").innerHTML;
g_selectGraphToLoad = document.getElementById("selectGraphToLoad").innerHTML; g_selectGraphToLoad = document.getElementById("selectGraphToLoad").innerHTML;
g_vertexNamePlaceHolder = document.getElementById("vertexNamePlaceHolder").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;
} }

View File

@ -982,6 +982,11 @@
<p id="selectGraphToLoad" class="translation"><?= L('load_oiginal_or_autosaved')?></p> <p id="selectGraphToLoad" class="translation"><?= L('load_oiginal_or_autosaved')?></p>
<p id="vertexNamePlaceHolder" class="translation"><?= L('vertex_name_place_holder')?></p> <p id="vertexNamePlaceHolder" class="translation"><?= L('vertex_name_place_holder')?></p>
<p id="maxIndependentSet" class="translation"><?= L('max_independent_set')?></p>
<p id="maxIndependentSetNotFound" class="translation"><?= L('max_independent_set_not_found')?></p>
<p id="maxIndependentSetSizeIs" class="translation"><?= L('max_independent_set_size_is')?></p>
<p id="maxIndependentSetContains" class="translation"><?= L('max_independent_set_contains')?></p>
</section> </section>
<script src="<?= RootCacheJS("script/pages/editor/api/index.js")?>" ></script> <script src="<?= RootCacheJS("script/pages/editor/api/index.js")?>" ></script>