mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 23:36:00 +00:00
Add Max Clique algorithm.
This commit is contained in:
parent
b6065ef901
commit
4d3085baa5
@ -297,4 +297,9 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -297,4 +297,9 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -265,4 +265,9 @@
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -262,4 +262,9 @@
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -297,4 +297,9 @@ Dodaliśmy polskie tłumaczenie, Patryk</a>";
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -263,4 +263,9 @@
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
@ -299,4 +299,9 @@
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Сохранить дугу для повторного использования";
|
||||
$g_lang["reuse_saved_edge"] = "Использовать сохраненную дугу";
|
||||
|
||||
$g_lang["max_clique"] = "Максимальная клика";
|
||||
$g_lang["max_clique_not_found"] = "Максимальная клика не найден";
|
||||
$g_lang["max_clique_size_is"] = "Размер Максимальной клики равена ";
|
||||
$g_lang["max_clique_contains"] = ". Клика содержит следующие вершины: ";
|
||||
?>
|
||||
|
@ -258,5 +258,10 @@
|
||||
$g_lang["snowflake"] = "Snowflake";
|
||||
|
||||
$g_lang["save_edge_for_future"] = "Save edge to reuse in the future";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
$g_lang["reuse_saved_edge"] = "Reuse saved edge";
|
||||
|
||||
$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: ";
|
||||
?>
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
100
script/plugins/MaxClique.js
Normal file
100
script/plugins/MaxClique.js
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Find Eulerian Loop.
|
||||
*
|
||||
*/
|
||||
function MaxClique(graph, app)
|
||||
{
|
||||
BaseAlgorithmEx.apply(this, arguments);
|
||||
this.message = g_processing;
|
||||
this.selectedObjects = [];
|
||||
}
|
||||
|
||||
|
||||
// inheritance.
|
||||
MaxClique.prototype = Object.create(BaseAlgorithmEx.prototype);
|
||||
|
||||
|
||||
MaxClique.prototype.getName = function(local)
|
||||
{
|
||||
return g_MaxClique;
|
||||
}
|
||||
|
||||
MaxClique.prototype.getId = function()
|
||||
{
|
||||
return "OlegSh.MaxClique";
|
||||
}
|
||||
|
||||
// @return message for user.
|
||||
MaxClique.prototype.getMessage = function(local)
|
||||
{
|
||||
return this.message;
|
||||
}
|
||||
|
||||
MaxClique.prototype.result = function(resultCallback)
|
||||
{
|
||||
this.outResultCallback = function (result ) { resultCallback(result); };
|
||||
self = this;
|
||||
this.CalculateAlgorithm("mc", [], function (pathObjects, properties, results)
|
||||
{
|
||||
self.resultCallback(pathObjects, properties, results);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MaxClique.prototype.resultCallback = function(pathObjects, properties, results)
|
||||
{
|
||||
result = results.length > 0 && results[0].value > 0 && results[0].type == 1;
|
||||
|
||||
var outputResult = {};
|
||||
outputResult["version"] = 1;
|
||||
|
||||
console.log("properties");
|
||||
console.log(properties);
|
||||
console.log("results");
|
||||
console.log(results);
|
||||
console.log("pathObjects");
|
||||
console.log(pathObjects);
|
||||
|
||||
this.message = result > 0 ? "" : g_MaxCliqueNotFound;
|
||||
if (result > 0)
|
||||
{
|
||||
let size = results[0].value;
|
||||
this.message = g_MaxCliqueSizeIs + size;
|
||||
|
||||
this.selectedObjects = [];
|
||||
|
||||
this.message = this.message + g_MaxCliqueContains;
|
||||
|
||||
var vertexIndex = 0;
|
||||
for (var i = 0; i < pathObjects.length; i++)
|
||||
{
|
||||
let object = pathObjects[i];
|
||||
if (object instanceof BaseVertex) {
|
||||
this.message = this.message + object.mainText + ((vertexIndex < size - 1) ? ", " : ".");
|
||||
vertexIndex++;
|
||||
}
|
||||
this.selectedObjects[object.id] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
this.outResultCallback(outputResult);
|
||||
}
|
||||
|
||||
MaxClique.prototype.getObjectSelectedGroup = function(object)
|
||||
{
|
||||
return (object.id in this.selectedObjects) ? this.selectedObjects[object.id] : 0;
|
||||
}
|
||||
|
||||
MaxClique.prototype.getPriority = function()
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
function CreateMaxClique(graph, app)
|
||||
{
|
||||
return new MaxClique(graph, app)
|
||||
}
|
||||
|
||||
// Gerister connected component.
|
||||
RegisterAlgorithm (CreateMaxClique);
|
@ -198,6 +198,11 @@ 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: ";
|
||||
|
||||
function loadTexts()
|
||||
{
|
||||
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
|
||||
@ -404,4 +409,9 @@ function loadTexts()
|
||||
g_fix = document.getElementById("fixButton").innerHTML;
|
||||
|
||||
g_reuseSavedEdge = document.getElementById("reuseSavedEdge").innerHTML;
|
||||
|
||||
g_MaxClique = document.getElementById("maxClique").innerHTML;
|
||||
g_MaxCliqueNotFound = document.getElementById("maxCliqueNotFound").innerHTML;
|
||||
g_MaxCliqueSizeIs = document.getElementById("maxCliqueSizeIs").innerHTML;
|
||||
g_MaxCliqueContains = document.getElementById("maxCliqueContains").innerHTML;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script>
|
||||
<script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script>
|
||||
<script src="<?= Root("script/canvas2svg.js")?>" ></script>
|
||||
<script src="<?= Root("script/example.js?v=71")?>" ></script>
|
||||
<script src="<?= Root("script/example.js?v=72")?>" ></script>
|
||||
|
||||
<!-- Yandex.RTB -->
|
||||
<script>window.yaContextCb=window.yaContextCb||[]</script>
|
||||
@ -866,7 +866,12 @@
|
||||
<p id="pairWrongFormat" class="translation"><?= L('edge_list_wrong_format')?></p>
|
||||
<p id="fixButton" class="translation"><?= L('fix_button')?></p>
|
||||
<p id="reuseSavedEdge" class="translation"><?= L('reuse_saved_edge')?></p>
|
||||
|
||||
|
||||
<p id="maxClique" class="translation"><?= L('max_clique')?></p>
|
||||
<p id="maxCliqueNotFound" class="translation"><?= L('max_clique_not_found')?></p>
|
||||
<p id="maxCliqueSizeIs" class="translation"><?= L('max_clique_size_is')?></p>
|
||||
<p id="maxCliqueContains" class="translation"><?= L('max_clique_contains')?></p>
|
||||
|
||||
</section>
|
||||
<!--
|
||||
<script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user