Retranslate the complete Japanese online edition from Chinese (#2008)

* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
This commit is contained in:
Yudong Jin
2026-10-30 02:12:26 +08:00
committed by GitHub
parent 455e8c1281
commit 7257641e0e
1987 changed files with 23531 additions and 23261 deletions
@@ -4,97 +4,97 @@
* Author: Zhuo Qinyue ([email protected])
*/
/* 隣接行列に基づく無向グラフクラス */
/* 隣接行列で実装した無向グラフクラス */
class GraphAdjMat {
vertices; // 頂点リスト。要素は「頂点値」、インデックスは「頂点インデックス」を表す
adjMat; // 隣接行列。行・列のインデックスは「頂点インデックス」に対応
vertices; // 頂点リスト。要素は「頂点の値」、インデックスは「頂点のインデックス」を表す
adjMat; // 隣接行列。行と列のインデックスは「頂点のインデックス」に対応する
/* コンストラクタ */
constructor(vertices, edges) {
this.vertices = [];
this.adjMat = [];
// 頂点を追加
// 頂点を追加する
for (const val of vertices) {
this.addVertex(val);
}
// 辺を追加
// 注意:edges の各要素は頂点インデックスを表し、vertices の要素インデックスに対応する
// 辺を追加する
// edges の要素は頂点のインデックス、すなわち vertices の要素のインデックスを表すことに注意
for (const e of edges) {
this.addEdge(e[0], e[1]);
}
}
/* 頂点数を取得 */
/* 頂点数を取得する */
size() {
return this.vertices.length;
}
/* 頂点を追加 */
/* 頂点を追加する */
addVertex(val) {
const n = this.size();
// 頂点リストに新しい頂点の値を追加
// 頂点リストに新しい頂点の値を追加する
this.vertices.push(val);
// 隣接行列に 1 行追加
// 隣接行列に 1 行追加する
const newRow = [];
for (let j = 0; j < n; j++) {
newRow.push(0);
}
this.adjMat.push(newRow);
// 隣接行列に 1 列追加
// 隣接行列に 1 列追加する
for (const row of this.adjMat) {
row.push(0);
}
}
/* 頂点を削除 */
/* 頂点を削除する */
removeVertex(index) {
if (index >= this.size()) {
throw new RangeError('Index Out Of Bounds Exception');
throw new RangeError('インデックス範囲外の例外');
}
// 頂点リストから index の頂点を削除する
// 頂点リストからインデックス index の頂点を削除する
this.vertices.splice(index, 1);
// 隣接行列で index 行を削除する
// 隣接行列からインデックス index の行を削除する
this.adjMat.splice(index, 1);
// 隣接行列で index 列を削除する
// 隣接行列からインデックス index の列を削除する
for (const row of this.adjMat) {
row.splice(index, 1);
}
}
/* 辺を追加 */
// 引数 i, j は vertices の要素インデックスに対応する
/* 辺を追加する */
// 引数 i, j は vertices の要素のインデックスに対応する
addEdge(i, j) {
// インデックスの範囲外と等値の処理
// 添字が範囲外または互いに等しい場合の処理
if (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {
throw new RangeError('Index Out Of Bounds Exception');
throw new RangeError('インデックス範囲外の例外');
}
// 無向グラフでは、隣接行列は主対角線に関して対称であり、(i, j) === (j, i) を満たす
// 無向グラフの隣接行列は主対角線に関して対称であり、(i, j) === (j, i) を満たす
this.adjMat[i][j] = 1;
this.adjMat[j][i] = 1;
}
/* 辺を削除 */
// 引数 i, j は vertices の要素インデックスに対応する
/* 辺を削除する */
// 引数 i, j は vertices の要素のインデックスに対応する
removeEdge(i, j) {
// インデックスの範囲外と等値の処理
// 添字が範囲外または互いに等しい場合の処理
if (i < 0 || j < 0 || i >= this.size() || j >= this.size() || i === j) {
throw new RangeError('Index Out Of Bounds Exception');
throw new RangeError('インデックス範囲外の例外');
}
this.adjMat[i][j] = 0;
this.adjMat[j][i] = 0;
}
/* 隣接行列を出力 */
/* 隣接行列を表示する */
print() {
console.log('頂点リスト = ', this.vertices);
console.log('隣接行列 =', this.adjMat);
}
}
/* Driver Code */
/* 無向グラフを初期化 */
// edges の要素は頂点インデックス、すなわち vertices の要素インデックスに対応する点に注意
/* 実行用コード */
/* 無向グラフを初期化する */
// edges の要素は頂点のインデックス、すなわち vertices の要素のインデックスを表すことに注意
const vertices = [1, 3, 2, 5, 4];
const edges = [
[0, 1],
@@ -105,28 +105,28 @@ const edges = [
[3, 4],
];
const graph = new GraphAdjMat(vertices, edges);
console.log('\n初期化後のグラフは');
console.log('\n初期化後のグラフ');
graph.print();
/* 辺を追加 */
/* 辺を追加する */
// 頂点 1, 2 のインデックスはそれぞれ 0, 2
graph.addEdge(0, 2);
console.log('\n辺 1-2 を追加した後のグラフは');
console.log('\n辺 1-2 を追加した後のグラフ');
graph.print();
/* 辺を削除 */
/* 辺を削除する */
// 頂点 1, 3 のインデックスはそれぞれ 0, 1
graph.removeEdge(0, 1);
console.log('\n辺 1-3 を削除した後のグラフは');
console.log('\n辺 1-3 を削除した後のグラフ');
graph.print();
/* 頂点を追加 */
/* 頂点を追加する */
graph.addVertex(6);
console.log('\n頂点 6 を追加した後のグラフは');
console.log('\n頂点 6 を追加した後のグラフ');
graph.print();
/* 頂点を削除 */
/* 頂点を削除する */
// 頂点 3 のインデックスは 1
graph.removeVertex(1);
console.log('\n頂点 3 を削除した後のグラフは');
console.log('\n頂点 3 を削除した後のグラフ');
graph.print();