mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 23:36:00 +00:00
Add check graphs isomophism.
Changed some default styles.
This commit is contained in:
parent
81d224c428
commit
8c3e607d2c
Binary file not shown.
@ -166,4 +166,18 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -204,4 +204,17 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
?>
|
||||
|
@ -203,4 +203,18 @@ We have added Dutch translation 🇳🇱. Thank you Willie de Wit</a>";
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -203,4 +203,18 @@ Tenemos traducciones en griego 🇬🇷.</a> <a href=\"https://github.com/UnickS
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -171,4 +171,18 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
@ -168,4 +168,18 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -170,4 +170,17 @@
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "Durante os cálculos ignoramos as direções dos vértices.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Grafo desconectado";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -204,4 +204,18 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Вес минимального остовного дерева равен ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "Мы игнорировали ориентацию дуг при рассчете.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Граф не является связным";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Выделите первый граф для проверки на изоморфизм. Кликните по любой вершине графа";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Выделите второй граф для проверки на изоморфизм. Кликните по любой вершине графа";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Выделите граф, которому должны быть изоморфны подграфов. Кликните по любой вершине графа";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Выделите граф в котором необходимо найти изоморфные подграфы. Кликните по любой вершине графа";
|
||||
$g_lang['graphs_isomorph'] = "Графы изоморфны";
|
||||
$g_lang['graphs_not_isomorph'] = "Графы не изоморфны";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Количество изоморфных подграфов равно ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Граф не содержит изоморфных подграфов";
|
||||
$g_lang['search_isomorph_subgraph'] = "Поиск изоморфных подграфов";
|
||||
$g_lang['subgraph_no'] = "Изоморфных подграф № ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "Для использования алгоритма необходимо создать хотя бы 2 не связных графа";
|
||||
$g_lang['isomorphism_check'] = "Проверка изоморфности графов";
|
||||
|
||||
?>
|
||||
|
@ -165,4 +165,18 @@
|
||||
$g_lang["min_spanning_tree_res_is"] = "Weight of minimum spanning tree is ";
|
||||
$g_lang["min_spanning_tree_ignore_direction"] = "In time of calculation we have ignored the edges direction.";
|
||||
$g_lang["min_spanning_tree_graph_not_connected"] = "Graph is disconnected";
|
||||
|
||||
$g_lang['select_first_graph_isomorphism_check'] = "Select first graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_second_graph_isomorphism_check'] = "Select second graph for isomorphic check. Click to any node of graph";
|
||||
$g_lang['select_first_graph_pattern_check'] = "Select a template graph by clicking to any node of graph";
|
||||
$g_lang['select_second_graph_for_search_subgraph'] = "Choose a graph in which we will look for isomorphic subgraphs. Click to any node of this graph";
|
||||
$g_lang['graphs_isomorph'] = "Graphs are isomorphic";
|
||||
$g_lang['graphs_not_isomorph'] = "Graphs are not isomorphic";
|
||||
$g_lang['number_of_isomorph_subgraph_is'] = "Number of isomorphic subgraphs are ";
|
||||
$g_lang['graph_has_no_isomorph_subgraph'] = "Graph doesn't contain isomorphic subgraphs";
|
||||
$g_lang['search_isomorph_subgraph'] = "Search isomorphic subgraphs";
|
||||
$g_lang['subgraph_no'] = "Isomorphic subgraph # ";
|
||||
$g_lang['graph_has_no_atleast_2_graphs'] = "To use the algorithm, you need to create 2 separate graphs";
|
||||
$g_lang['isomorphism_check'] = "Check Graphs Isomorphism";
|
||||
|
||||
?>
|
||||
|
@ -156,6 +156,9 @@ BaseAlgorithmEx.prototype = Object.create(BaseAlgorithm.prototype);
|
||||
|
||||
BaseAlgorithmEx.prototype.CalculateAlgorithm = function(queryString, resultCallback)
|
||||
{
|
||||
if (location.hostname === "localhost" || location.hostname === "127.0.0.1")
|
||||
console.log(queryString);
|
||||
|
||||
var graph = this.graph;
|
||||
var creator = new GraphMLCreater(graph.vertices, graph.edges);
|
||||
var pathObjects = [];
|
||||
|
@ -38,7 +38,7 @@ function SelectedVertexStyle1()
|
||||
CommonVertexStyle.apply(this, arguments);
|
||||
|
||||
this.strokeStyle = '#7a9ba0';
|
||||
this.mainTextColor = '#7a9ba0';
|
||||
this.mainTextColor = '#c3d2d5';
|
||||
this.fillStyle = '#534641';
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ function SelectedVertexStyle2()
|
||||
CommonVertexStyle.apply(this, arguments);
|
||||
|
||||
this.strokeStyle = '#8C4C86';
|
||||
this.mainTextColor = '#8C4C86';
|
||||
this.mainTextColor = '#dbbdd8';
|
||||
this.fillStyle = '#253267';
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
function FindConnectedComponentNew(graph, app)
|
||||
{
|
||||
BaseAlgorithm.apply(this, arguments);
|
||||
this.connectedComponentNumber = 0;
|
||||
this.connectedComponentNumber = 0;
|
||||
this.component = {};
|
||||
this.selectedObjects = [];
|
||||
}
|
||||
|
292
script/plugins/IsomorphismCheck.js
Normal file
292
script/plugins/IsomorphismCheck.js
Normal file
@ -0,0 +1,292 @@
|
||||
/**
|
||||
* Find short path.
|
||||
*
|
||||
*/
|
||||
|
||||
function IsomorphismCheck(graph, app)
|
||||
{
|
||||
BaseAlgorithmEx.apply(this, arguments);
|
||||
|
||||
if (graph && app)
|
||||
{
|
||||
this.connectedComponent = new FindConnectedComponentNew(graph, app);
|
||||
this.connectedComponent.calculate();
|
||||
}
|
||||
|
||||
this.setFirstMessage();
|
||||
this.prevCalculated = false;
|
||||
this.searchSubGraphs = false;
|
||||
this.foundSubGraphs = {};
|
||||
this.nSubgraphIndex = 0;
|
||||
this.nSubGraphCount = 0;
|
||||
this.bIsomorph = false;
|
||||
}
|
||||
|
||||
|
||||
// inheritance.
|
||||
IsomorphismCheck.prototype = Object.create(BaseAlgorithmEx.prototype);
|
||||
// First selected.
|
||||
IsomorphismCheck.prototype.firstGraph = null;
|
||||
// Second selected.
|
||||
IsomorphismCheck.prototype.secondGraph = null;
|
||||
|
||||
|
||||
IsomorphismCheck.prototype.getName = function(local)
|
||||
{
|
||||
return g_IsomorphismCheck;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.getId = function()
|
||||
{
|
||||
return "OlegSh.IsomorphismCheck";
|
||||
}
|
||||
|
||||
// @return message for user.
|
||||
IsomorphismCheck.prototype.getMessage = function(local)
|
||||
{
|
||||
return this.message;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.result = function(resultCallback)
|
||||
{
|
||||
if (this.firstGraph && this.secondGraph)
|
||||
{
|
||||
this.outResultCallback = function (result ) { resultCallback(result); };
|
||||
self = this;
|
||||
this.CalculateAlgorithm("isocheck=cgiInput&graph1=" + this.getGraphEdges(this.firstGraph) + "&graph2=" + this.getGraphEdges(this.secondGraph) + "&report=xml" + (this.searchSubGraphs ? "&searchSubgraphs=true": ""), function (pathObjects, properties, results)
|
||||
{
|
||||
self.resultCallback(pathObjects, properties, results);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.getGraphEdges = function(nodesAndEdges)
|
||||
{
|
||||
var res = ""
|
||||
for (var key in nodesAndEdges)
|
||||
{
|
||||
var edgeObject = this.graph.FindEdgeById(key);
|
||||
if (edgeObject)
|
||||
{
|
||||
if (res != "")
|
||||
res = res + ","
|
||||
res = res + edgeObject.vertex1.id + "-" + edgeObject.vertex2.id;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.resultCallback = function(pathObjects, properties, results)
|
||||
{
|
||||
var outputResult = {};
|
||||
outputResult["version"] = 1;
|
||||
|
||||
if (!this.searchSubGraphs)
|
||||
{
|
||||
this.bIsomorph = results.length > 0 && results[0].type == 1 && results[0].value == 1;
|
||||
|
||||
this.setResultMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.nSubGraphCount = results.length > 0 && results[0].type == 1 ? results[0].value : 0;
|
||||
|
||||
this.setResultMessage();
|
||||
|
||||
this.foundSubGraphs = {};
|
||||
for (var i = 0; i < this.nSubGraphCount; i++)
|
||||
{
|
||||
this.foundSubGraphs[i] = {};
|
||||
}
|
||||
|
||||
var subGraphIndex = 0;
|
||||
for (var i = 0; i < results.length; i++)
|
||||
{
|
||||
if (results[i].type == 6)
|
||||
{
|
||||
subGraphIndex++;
|
||||
}
|
||||
|
||||
if (results[i].type == 5)
|
||||
{
|
||||
var edgeId = parseInt(results[i].value);
|
||||
var index = subGraphIndex;
|
||||
var subgGraph = this.foundSubGraphs[index];
|
||||
subgGraph[edgeId] = true;
|
||||
var edgeObject = this.graph.FindEdgeById(edgeId);
|
||||
subgGraph[edgeObject.vertex1.id] = true;
|
||||
subgGraph[edgeObject.vertex2.id] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.prevCalculated = true;
|
||||
this.outResultCallback(outputResult);
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.selectVertex = function(vertex)
|
||||
{
|
||||
if (this.connectedComponent && this.connectedComponent.connectedComponentNumber <= 1)
|
||||
return true;
|
||||
|
||||
if (this.firstGraph && !this.prevCalculated && (!this.firstGraph || !(vertex.id in this.firstGraph)))
|
||||
{
|
||||
this.message = g_processing;
|
||||
this.secondGraph = this.getGraphWithNode(vertex);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.deselectAll();
|
||||
|
||||
this.firstGraph = this.getGraphWithNode(vertex);
|
||||
this.secondGraph = null;
|
||||
this.setSecondMessage();
|
||||
this.app.updateMessage();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.deselectAll = function()
|
||||
{
|
||||
this.firstGraph = null;
|
||||
this.secondGraph = null;
|
||||
this.prevCalculated = false;
|
||||
this.setFirstMessage();
|
||||
this.restore();
|
||||
this.foundSubGraphs = {};
|
||||
this.nSubgraphIndex = 0;
|
||||
this.nSubGraphCount = 0;
|
||||
this.bIsomorph = false;
|
||||
|
||||
this.app.updateMessage();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.instance = function()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.getObjectSelectedGroup = function(object)
|
||||
{
|
||||
return (this.nSubgraphIndex in this.foundSubGraphs && object.id in this.foundSubGraphs[this.nSubgraphIndex]) ? 3 :
|
||||
(this.firstGraph && object.id in this.firstGraph) ? 1 : ((this.secondGraph && object.id in this.secondGraph) ? 2 : 0);
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.getPriority = function()
|
||||
{
|
||||
return -8.0;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.getGraphWithNode = function(node)
|
||||
{
|
||||
var res = {}
|
||||
if (node.id in this.connectedComponent.component)
|
||||
{
|
||||
var componentNumber = this.connectedComponent.component[node.id];
|
||||
for (var key in this.connectedComponent.component)
|
||||
{
|
||||
if (this.connectedComponent.component[key] == componentNumber)
|
||||
{
|
||||
res[key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.setFirstMessage = function()
|
||||
{
|
||||
if (this.connectedComponent && this.connectedComponent.connectedComponentNumber <= 1)
|
||||
{
|
||||
this.message = g_graphHasNoAtleast2Graphs;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.searchSubGraphs)
|
||||
this.message = g_selectFirstGraphIsomorphismCheck + "<input id=\"searchSubGraph\" type=\"checkbox\" " + (this.searchSubGraphs ? "checked": "")+ " style=\"float:right\">" + "<label style=\"margin-bottom: 0px;float:right\">" + g_searchIsomorphSubgraph + " </label>";
|
||||
else
|
||||
this.message = g_selectFirstGraphPatternCheck + "<input id=\"searchSubGraph\" type=\"checkbox\" " + (this.searchSubGraphs ? "checked": "")+ " style=\"float:right\">" + "<label style=\"margin-bottom: 0px;float:right\">" + g_searchIsomorphSubgraph + " </label>";
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.setSecondMessage = function()
|
||||
{
|
||||
if (!this.searchSubGraphs)
|
||||
this.message = g_selectSecondGraphIsomorphismCheck + "<input id=\"searchSubGraph\" type=\"checkbox\" " + (this.searchSubGraphs ? "checked": "")+ " style=\"float:right\">" + "<label style=\"margin-bottom: 0px;float:right\">" + g_searchIsomorphSubgraph + " </label>";
|
||||
else
|
||||
this.message = g_selectSecondGraphForSearchSubgraph + "<input id=\"searchSubGraph\" type=\"checkbox\" " + (this.searchSubGraphs ? "checked": "")+ " style=\"float:right\">" + "<label style=\"margin-bottom: 0px;float:right\">" + g_searchIsomorphSubgraph + " </label>";
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.setResultMessage = function()
|
||||
{
|
||||
if (!this.searchSubGraphs)
|
||||
{
|
||||
if (this.bIsomorph)
|
||||
{
|
||||
this.message = g_graphsIsomorph;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.message = g_graphsNotIsomorph;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.nSubGraphCount > 0)
|
||||
{
|
||||
this.message = g_numberOfIsomorphSubgraphIs + this.nSubGraphCount + " <select style=\"float:right\" id=\"enumSubgraphs\"></select>";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.message = g_graphHasNoIsomorphSubgraph;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IsomorphismCheck.prototype.messageWasChanged = function()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if ($('#searchSubGraph'))
|
||||
{
|
||||
$('#searchSubGraph').change(function() {
|
||||
self.searchSubGraphs = this.checked;
|
||||
if (self.firstGraph && !self.prevCalculated)
|
||||
self.setSecondMessage();
|
||||
else
|
||||
self.setFirstMessage();
|
||||
|
||||
self.app.updateMessage();
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#enumSubgraphs'))
|
||||
{
|
||||
for (var i = 0; i < this.nSubGraphCount; i++)
|
||||
{
|
||||
$('#enumSubgraphs').append("<option value=\"" + i + "\"" + (self.nSubgraphIndex==i ? "selected": "") + ">" +
|
||||
g_subgraphNo + (i + 1) +
|
||||
"</option>");
|
||||
}
|
||||
|
||||
$('#enumSubgraphs').change(function () {
|
||||
self.nSubgraphIndex = $('#enumSubgraphs').val();
|
||||
self.app.redrawGraph();
|
||||
self.setResultMessage();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Factory for connected components.
|
||||
function CreateIsomorphismCheck(graph, app)
|
||||
{
|
||||
return new IsomorphismCheck(graph, app)
|
||||
}
|
||||
|
||||
// Gerister connected component.
|
||||
RegisterAlgorithm (CreateIsomorphismCheck);
|
@ -132,6 +132,21 @@ 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";
|
||||
|
||||
function loadTexts()
|
||||
{
|
||||
g_textsSelectAndMove = document.getElementById("SelectAndMoveObject").innerHTML;
|
||||
@ -271,4 +286,19 @@ function loadTexts()
|
||||
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;
|
||||
}
|
||||
|
16
tpl/home.php
16
tpl/home.php
@ -604,7 +604,21 @@
|
||||
<p id="MinSpanningTreeResult" class="translation"><?= L('min_spanning_tree_res_is')?></p>
|
||||
<p id="MinSpanningIgnoreDir" class="translation"><?= L('min_spanning_tree_ignore_direction')?></p>
|
||||
<p id="MinSpanningNotConnected" class="translation"><?= L('min_spanning_tree_graph_not_connected')?></p>
|
||||
|
||||
|
||||
|
||||
<p id="SelectFirstGraphIsomorphismCheck" class="translation"><?= L('select_first_graph_isomorphism_check')?></p>
|
||||
<p id="SelectSecondGraphIsomorphismCheck" class="translation"><?= L('select_second_graph_isomorphism_check')?></p>
|
||||
<p id="SelectFirstGraphPatternCheck" class="translation"><?= L('select_first_graph_pattern_check')?></p>
|
||||
<p id="SelectSecondGraphForSearchSubgraph" class="translation"><?= L('select_second_graph_for_search_subgraph')?></p>
|
||||
<p id="GraphsIsomorph" class="translation"><?= L('graphs_isomorph')?></p>
|
||||
<p id="GraphsNotIsomorph" class="translation"><?= L('graphs_not_isomorph')?></p>
|
||||
<p id="NumberOfIsomorphSubgraphIs" class="translation"><?= L('number_of_isomorph_subgraph_is')?></p>
|
||||
<p id="GraphHasNoIsomorphSubgraph" class="translation"><?= L('graph_has_no_isomorph_subgraph')?></p>
|
||||
<p id="SearchIsomorphSubgraph" class="translation"><?= L('search_isomorph_subgraph')?></p>
|
||||
<p id="SubgraphNo" class="translation"><?= L('subgraph_no')?></p>
|
||||
<p id="GraphHasNoAtleast2Graphs" class="translation"><?= L('graph_has_no_atleast_2_graphs')?></p>
|
||||
<p id="IsomorphismCheck" class="translation"><?= L('isomorphism_check')?></p>
|
||||
|
||||
</section>
|
||||
<!--
|
||||
<script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user