Added use of locale in Radius and Diameter algorithm

This commit is contained in:
serd2011
2021-09-19 18:27:12 +03:00
parent b2919829e3
commit c145c53ec8
12 changed files with 116 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ RadiusAndDiameter.prototype = Object.create(BaseAlgorithm.prototype);
RadiusAndDiameter.prototype.getName = function(local)
{
return g_RadiusAndDiameter; //local == "ru" ? "Поиск радиуса и диаметра графа": "Search graph radius and diameter";
return g_RadiusAndDiameter;
}
RadiusAndDiameter.prototype.getId = function()
@@ -35,15 +35,15 @@ RadiusAndDiameter.prototype.getMessage = function(local)
{
if (this.isNotConnected)
{
return (local == "ru" ? "Граф не является связным" : "Graph is disconnected");
return g_graphIsDisconnected;
}
if (this.isOneVertex)
{
return (local == "ru" ? "Граф содержит только одну вершину" : "Graph contains only one vertex");
return g_graphIsTrivial;
}
var text = (local == "ru" ? "Радиус графа: " : "Graph radius: ") + this.radius;
var text = g_graphRadius + ": " + this.radius;
text = text + " (";
for (i = 0; i < this.radiusSelectedObjects.length; i++)
@@ -55,7 +55,7 @@ RadiusAndDiameter.prototype.getMessage = function(local)
}
text = text + ").";
text = text + (local == "ru" ? " Диаметр графа: " : "Graph diameter: ") + this.diameter;
text = text + " " + g_graphDiameter + ": " + this.diameter;
text = text + " (";
for (i = 0; i < this.diameterSelectedObjects.length; i++)
@@ -149,12 +149,12 @@ RadiusAndDiameter.prototype.result = function(resultCallback)
if (eccentricity[i].value == this.radius)
{
this.centerVertexes.push(this.graph.vertices[i].id);
this.graph.vertices[i].upText = (g_language == "ru" ? "Центральная" : "Central");
this.graph.vertices[i].upText = g_vertexCentral;
}
if (eccentricity[i].value == this.diameter)
{
this.peripheralVertexes.push(this.graph.vertices[i].id);
this.graph.vertices[i].upText = (g_language == "ru" ? "Периферийная" : "Peripheral");
this.graph.vertices[i].upText = g_vertexPeripheral;
}
}

View File

@@ -138,6 +138,7 @@ var g_selectSecondGraphIsomorphismCheck = "Select second graph for isomorphic ch
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";
// IsomorphismCheck.js
var g_graphsIsomorph = "Graphs are isomorphic";
var g_graphsNotIsomorph = "Graphs are not isomorphic";
var g_numberOfIsomorphSubgraphIs = "Number of isomorphic subgraphs are ";
@@ -147,6 +148,14 @@ 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";
// RadiusAndDiameter.js
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_action = "Action";
var g_commonEdgeStyle = "Common Edge Style";
var g_selectedEdgeStyle = "Selected Edge Style";
@@ -298,7 +307,8 @@ function loadTexts()
g_selectFirstGraphPatternCheck = document.getElementById("SelectFirstGraphPatternCheck").innerHTML;
g_selectSecondGraphForSearchSubgraph = document.getElementById("SelectSecondGraphForSearchSubgraph").innerHTML;
// IsomorphismCheck.js
g_graphsIsomorph = document.getElementById("GraphsIsomorph").innerHTML;
g_graphsNotIsomorph = document.getElementById("GraphsNotIsomorph").innerHTML;
g_numberOfIsomorphSubgraphIs = document.getElementById("NumberOfIsomorphSubgraphIs").innerHTML;
@@ -308,6 +318,14 @@ function loadTexts()
g_graphHasNoAtleast2Graphs = document.getElementById("GraphHasNoAtleast2Graphs").innerHTML;
g_IsomorphismCheck = document.getElementById("IsomorphismCheck").innerHTML;
// RadiusAndDiameter.js
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_action = document.getElementById("ActionText").innerHTML;
g_commonEdgeStyle = document.getElementById("CommonEdgeStyleText").innerHTML;
g_selectedEdgeStyle = document.getElementById("SelectedEdgeStyleText").innerHTML;