スモールワールド -- it might be a small world!

戻る

$ java GraphModel 30

///////////////////////////////////////////////
// 隣接するノードを一覧表示します
///////////////////////////////////////////////
0
	[29] [1] 
1
	[0] [2] 
2
	[1] [3] 
3
	[2] [4] 
4
	[3] [5] 
5
	[4] [6] 
6
	[5] [7] 
7
	[6] [8] 
8
	[7] [9] 
9
	[8] [10] 
10
	[9] [11] 
11
	[10] [12] 
12
	[11] [13] 
13
	[12] [14] 
14
	[13] [15] 
15
	[14] [16] 
16
	[15] [17] 
17
	[16] [18] 
18
	[17] [19] 
19
	[18] [20] 
20
	[19] [21] 
21
	[20] [22] 
22
	[21] [23] 
23
	[22] [24] 
24
	[23] [25] 
25
	[24] [26] 
26
	[25] [27] 
27
	[26] [28] 
28
	[27] [29] 
29
	[0] [28] 

■クラスタ化指数= 2.000
■隔たり次数    = 7.759

///////////////////////////////////////////////
// 隣接するノードを一覧表示します
///////////////////////////////////////////////
0
	[29] [1] [10] [20] 
1
	[0] [2] 
2
	[1] [3] 
3
	[2] [4] 
4
	[3] [5] 
5
	[4] [6] 
6
	[5] [7] 
7
	[6] [8] 
8
	[7] [9] 
9
	[8] [10] 
10
	[9] [11] [0] 
11
	[10] [12] 
12
	[11] [13] 
13
	[12] [14] 
14
	[13] [15] 
15
	[14] [16] [29] 
16
	[15] [17] 
17
	[16] [18] 
18
	[17] [19] 
19
	[18] [20] 
20
	[19] [21] [0] 
21
	[20] [22] 
22
	[21] [23] 
23
	[22] [24] 
24
	[23] [25] 
25
	[24] [26] 
26
	[25] [27] 
27
	[26] [28] 
28
	[27] [29] 
29
	[0] [28] [15] 

■クラスタ化指数= 2.200
■隔たり次数    = 4.618



///////////////////////////////////////////////////////////////////////////////////////
0 から自身に戻るまでのPATH一覧 
///////////////////////////////////////////////////////////////////////////////////////

[0] 
[0] [29] 
[0] [29] [28] 
[0] [29] [28] [27] 
[0] [29] [28] [27] [26] 
[0] [29] [28] [27] [26] [25] 
[0] [29] [28] [27] [26] [25] [24] 
[0] [29] [28] [27] [26] [25] [24] [23] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] 
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [29] [15] 
[0] [29] [15] [14] 
[0] [29] [15] [14] [13] 
[0] [29] [15] [14] [13] [12] 
[0] [29] [15] [14] [13] [12] [11] 
[0] [29] [15] [14] [13] [12] [11] [10] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [29] [15] [16] 
[0] [29] [15] [16] [17] 
[0] [29] [15] [16] [17] [18] 
[0] [29] [15] [16] [17] [18] [19] 
[0] [29] [15] [16] [17] [18] [19] [20] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] 
[0] [29] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] 
[0] [1] 
[0] [1] [2] 
[0] [1] [2] [3] 
[0] [1] [2] [3] [4] 
[0] [1] [2] [3] [4] [5] 
[0] [1] [2] [3] [4] [5] [6] 
[0] [1] [2] [3] [4] [5] [6] [7] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] 
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] 
[0] [10] 
[0] [10] [9] 
[0] [10] [9] [8] 
[0] [10] [9] [8] [7] 
[0] [10] [9] [8] [7] [6] 
[0] [10] [9] [8] [7] [6] [5] 
[0] [10] [9] [8] [7] [6] [5] [4] 
[0] [10] [9] [8] [7] [6] [5] [4] [3] 
[0] [10] [9] [8] [7] [6] [5] [4] [3] [2] 
[0] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [10] [11] 
[0] [10] [11] [12] 
[0] [10] [11] [12] [13] 
[0] [10] [11] [12] [13] [14] 
[0] [10] [11] [12] [13] [14] [15] 
[0] [10] [11] [12] [13] [14] [15] [16] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] 
[0] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] 
[0] [10] [11] [12] [13] [14] [15] [29] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] 
[0] [10] [11] [12] [13] [14] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] 
[0] [20] 
[0] [20] [19] 
[0] [20] [19] [18] 
[0] [20] [19] [18] [17] 
[0] [20] [19] [18] [17] [16] 
[0] [20] [19] [18] [17] [16] [15] 
[0] [20] [19] [18] [17] [16] [15] [14] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [20] [19] [18] [17] [16] [15] [29] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] [25] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] [25] [24] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] [25] [24] [23] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] [25] [24] [23] [22] 
[0] [20] [19] [18] [17] [16] [15] [29] [28] [27] [26] [25] [24] [23] [22] [21] 
[0] [20] [21] 
[0] [20] [21] [22] 
[0] [20] [21] [22] [23] 
[0] [20] [21] [22] [23] [24] 
[0] [20] [21] [22] [23] [24] [25] 
[0] [20] [21] [22] [23] [24] [25] [26] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [16] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [16] [17] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [16] [17] [18] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [16] [17] [18] [19] 
----------------------------------------------------------
[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [1] 
[0] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1] 
最小ホップ数: 1

[0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1]  // 距離= 6.063 
[0] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1]  // 距離= 5.125 
[0] [1]  // 距離= 0.209 
[0] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1]  // 距離= 3.614 
[0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1]  // 距離= 5.704 
[0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] [7] [6] [5] [4] [3] [2] [1]  // 距離= 8.529 
最短経路(距離):    0.209

----------------------------------------------------------
[4] [3] [2] [1] [0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] 
[4] [3] [2] [1] [0] [29] [15] [14] [13] [12] [11] [10] [9] [8] 
[4] [3] [2] [1] [0] [10] [9] [8] 
[4] [3] [2] [1] [0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8] 
[4] [3] [2] [1] [0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8] 
[4] [5] [6] [7] [8] 
最小ホップ数: 4

[4] [3] [2] [1] [0] [29] [28] [27] [26] [25] [24] [23] [22] [21] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8]  // 距離= 5.435 
[4] [3] [2] [1] [0] [29] [15] [14] [13] [12] [11] [10] [9] [8]  // 距離= 4.498 
[4] [3] [2] [1] [0] [10] [9] [8]  // 距離= 2.986 
[4] [3] [2] [1] [0] [20] [19] [18] [17] [16] [15] [14] [13] [12] [11] [10] [9] [8]  // 距離= 5.077 
[4] [3] [2] [1] [0] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [15] [14] [13] [12] [11] [10] [9] [8]  // 距離= 7.902 
[4] [5] [6] [7] [8]  // 距離= 0.836 
最短経路(距離):    0.836

///////////////////////////////////////////////
// 隣接するノードを一覧表示します
///////////////////////////////////////////////
0
	
1
	
2
	
3
	
4
	
5
	
6
	
7
	
8
	
9
	
10
	
11
	
12
	
13
	
14
	
15
	
16
	
17
	
18
	
19
	
20
	
21
	
22
	
23
	
24
	
25
	
26
	
27
	
28
	
29
	

///////////////////////////////////////////////
// 隣接するノードを一覧表示します
///////////////////////////////////////////////
0
	[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] 
1
	[0] 
2
	[0] 
3
	[0] 
4
	[0] 
5
	[0] 
6
	[0] 
7
	[0] 
8
	[0] 
9
	[0] 
10
	[0] 
11
	[0] 
12
	[0] 
13
	[0] 
14
	[0] 
15
	[0] 
16
	[0] 
17
	[0] 
18
	[0] 
19
	[0] 
20
	[0] 
21
	[0] 
22
	[0] 
23
	[0] 
24
	[0] 
25
	[0] 
26
	[0] 
27
	[0] 
28
	[0] 
29
	[0] 

■クラスタ化指数= 1.933
■隔たり次数    = 1.933

::::::::::::::
Element.java
::::::::::::::
import java.util.*;

/**
$Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
@author KISHI Yasuhiro
*/

public class Element {
    /** 自身が接続しているリンク */
    private List links;
    /** 名前 */
    private String name;
    /** 位置を示す座標 */
    private Point point;

    public Element( String name ) {
        this.name = name;
    }

    /** 位置を与える */
    public void setLocation( Point point ) {
        this.point = point;
    }

    /** 位置を与える */
    public void setLocation( double x, double y ) {
        this.point = new Point( x, y );
    }

    /** 位置を取得する */
    public Point getLocation() {
        return this.point;
    }

    /** リンクを追加する */
    public void addLink( Element element ) {
        if ( links == null ) {
            links = new LinkedList();
        }

        links.add( element );
    }

    /** 相手とリンクしているか否か */
    public boolean hasRelationWith( Element counterElement ) {
        return ( links != null ) && links.contains( counterElement );
    }

    public List getLinks() {
        return links;
    }

    public String getName() {
        return name;
    }

    /** 自身がもつリンクをクリアする */
    public void deleteLinks() {
        links.clear();
    }
}
::::::::::::::
GraphModel.java
::::::::::::::
import java.util.*;

/**
* $Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
* @author KISHI Yasuhiro
* 2005.05.06 このモデルを使うクライアントからはElementを意識になくてもいいように変更
* 少ないリンク(クラスタ化指数に比例)で隔たり次数を小さくする方法を考えてみる
*/

public class GraphModel {
    /** Elementのインスタンスをリスト化したもの */
    private List list;

    /**
    @param count 要素数
    */
    public GraphModel( int count ) {
        list = new LinkedList();
        for ( int i = 0;i < count;i++ ) {
            list.add( new Element( String.valueOf( i ) ) );
        }
    }

    /** 指定した要素が持つリンクを全てクリアする */
    public void deleteLinks( int index ) {
        Element element = ( Element ) list.get( index );
        element.deleteLinks();
    }

    /** クラスター化指数を求める */
    public double getClusteredDegree() {
        double degree = 0.0;

        // 全要素を走査
        int linkCount = 0;
        Iterator iterator = list.iterator();
        while ( iterator.hasNext() ) {

            Element element = ( Element ) iterator.next();
            List links = element.getLinks();
            linkCount += links.size();

        }
        degree = ( double ) linkCount / list.size();

        return degree;
    }

    /** 要素同士をつなぐ
    * @param index1 要素の位置
    * @param index2 要素の位置
    */
    public void linkElements( int index1, int index2 ) {
        Element e1 = ( Element ) list.get( index1 );
        Element e2 = ( Element ) list.get( index2 );

        if ( !e1.hasRelationWith( e2 ) ) {
            e1.addLink( e2 );
        }
        if ( !e2.hasRelationWith( e1 ) ) {
            e2.addLink( e1 );
        }
    }

    /**
    * ダンプする
    * -- 隣接するノードを一覧表示する
    */
    public void dumpList() {
        System.out.println( "///////////////////////////////////////////////" );
        System.out.println( "// 隣接するノードを一覧表示します" );
        System.out.println( "///////////////////////////////////////////////" );

        Iterator iterator = list.iterator();
        while ( iterator.hasNext() ) {

            Element element = ( Element ) iterator.next();
            System.out.println( element.getName() );

            // 各要素がリンクしている要素を出力
            System.out.print( "\t" );
            List links = element.getLinks();
            if ( links != null ) {
                Iterator itrt = links.iterator();
                while ( itrt.hasNext() ) {
                    Element linkedElement = ( Element ) itrt.next();
                    System.out.print( "[" + linkedElement.getName() + "] " );
                }
                System.out.println();
            } else {
                System.out.println( "*** has no link ***" );
            }
        }
        System.out.println();

    }

    public List getList() {
        return list;
    }

    /**
    * 隔たり次数を求める
    * -- 全要素に対して最短経路のホップ数を求めて、平均値を出せば、「隔たり次数」を求めることが可能
    * @return 隔たり次数
    */
    public double getDistantDegree() {
        PathTraverser traverser = new PathTraverser( list );
        int combinationCount = 0;
        int distance = 0;
        for ( int i = 0;i < list.size();i++ ) {

            for ( int j = i + 1;j < list.size();j++ ) {

                List combination = traverser.getAllPathsBetween( i, j );
                int minimumHopCount = PathCombinationAnalyzer.getMinimunHopCount( combination );

                // System.out.println( i + "," + j);
                // System.out.println("minimumHopCount="+minimumHopCount);

                distance += minimumHopCount;
                combinationCount++;
            }
        }

        return ( double ) distance / combinationCount;
    }

    /** テスト用のメソッド */
    static public void main( String[] args ) {

        if ( args.length != 1 ) {
            System.err.println( "Usage: java GraphModel [CountOfElements]" );
            System.exit( 1 );
        }
        int count = new Integer( args[ 0 ] ).intValue();

        //-----------------------------------------------------------------
        // 【初期状態】では単なる環状リンクになるように設定する
        //-----------------------------------------------------------------
        GraphModel model = new GraphModel( count );
        List list = model.getList();

        // 位置情報をセットする
        LocationProvider.provideCircularLocations( list, 0.0, 0.0, 1.0 );

        // 先頭末尾をリンクさせる
        model.linkElements( 0, list.size() - 1 );

        // 並び合う要素にリンクを設定する(先頭末尾以外)
        for ( int i = 0;i < list.size() - 1;i++ ) {
            model.linkElements( i, i + 1 );
        }

        model.dumpList();
        // クラスター化指数を求める
        System.out.printf( "■クラスタ化指数=%6.3f\n", model.getClusteredDegree() );
        // 隔たり次数を求める
        System.out.printf( "■隔たり次数    =%6.3f\n", model.getDistantDegree() );
        System.out.println();

        //--------------------------------------
        // 適当にリンクを設定する
        //--------------------------------------
        int index1 = ( int ) ( list.size() / 3 );
        int index2 = ( int ) ( list.size() * 2 / 3 );
        int index3 = ( int ) ( list.size() / 2 );

        model.linkElements( 0, index1 );
        model.linkElements( 0, index2 );
        model.linkElements( list.size() - 1, index3 );

        model.dumpList();
        // クラスター化指数を求める
        System.out.printf( "■クラスタ化指数=%6.3f\n", model.getClusteredDegree() );
        // 隔たり次数を求める
        System.out.printf( "■隔たり次数    =%6.3f\n", model.getDistantDegree() );
        System.out.println();

        //-------------------------------------------------------------
        // 各種コンポーネントの動作確認用のコード
        //-------------------------------------------------------------
        PathTraverser traverser = new PathTraverser( list );
        traverser.getAllPathsFrom( 0 );

        List combination;
        System.out.println( "----------------------------------------------------------" );
        /* 0番目の要素から1番目の要素までへのパスを求める */
        combination = traverser.getAllPathsBetween( 0, 1 );
        PathCombinationAnalyzer.dump( combination );
        System.out.println( "最小ホップ数: " + PathCombinationAnalyzer.getMinimunHopCount( combination ) );
        System.out.println();
        ////////////////////////////////////////////////////
        // 最短距離とそのPATHを求める
        ////////////////////////////////////////////////////
        System.out.printf( "最短経路(距離): %8.3f\n" , PathCombinationAnalyzer.getShortestPath( combination ) );
        System.out.println();

        System.out.println( "----------------------------------------------------------" );
        /* 4番目の要素から8番目の要素までへのパスを求める */
        combination = traverser.getAllPathsBetween( 4, 8 );
        PathCombinationAnalyzer.dump( combination );
        System.out.println( "最小ホップ数: " + PathCombinationAnalyzer.getMinimunHopCount( combination ) );
        System.out.println();
        ////////////////////////////////////////////////////
        // 最短距離とそのPATHを求める
        ////////////////////////////////////////////////////
        System.out.printf( "最短経路(距離): %8.3f\n" , PathCombinationAnalyzer.getShortestPath( combination ) );
        System.out.println();

        //----------------------------------------------------------------
        // 理想的なリンク構造を試す
        // 全要素を直接あるいは間接に繋ぐには最低N-1個のコネクションが必要
        //----------------------------------------------------------------
        // 一旦全てのリンクをクリア
        for ( int i = 0;i < list.size();i++ ) {
            model.deleteLinks( i );
        }
        model.dumpList();

        // 要素0に対して残りの要素を全てリンクされる(→0がハブとなる)
        for ( int i = 1;i < list.size();i++ ) {
            model.linkElements( 0, i );
        }
        model.dumpList();

        // クラスター化指数を求める
        System.out.printf( "■クラスタ化指数=%6.3f\n", model.getClusteredDegree() );
        // 隔たり次数を求める
        System.out.printf( "■隔たり次数    =%6.3f\n", model.getDistantDegree() );
        System.out.println();
    }

}
::::::::::::::
LocationProvider.java
::::::::::::::
import java.util.*;

/**
* $Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
* @author KISHI Yasuhiro
* Elementクラスのインスタンスに対して定型的な位置情報を与えるクラス
* いろいろな雛形を用意する
*/

public class LocationProvider {
    /**
    * @param elementList 要素のリスト
    * @param cx 中心点のX座標
    * @param cy 中心点のX座標
    * @param radius 半径
    */
    static public void provideCircularLocations( List elementList, double cx, double cy, double radius ) {

        double interval = 360.0 / elementList.size();
        double angle = 0.0;
        Iterator iterator = elementList.iterator();
        while ( iterator.hasNext() ) {
            Element element = ( Element ) iterator.next();

            double x = cx + radius * Math.cos( SmallWorldUtils.degreeToRadian( angle ) );
            double y = cy + radius * Math.sin( SmallWorldUtils.degreeToRadian( angle ) );

            // System.out.printf( "%8.3f %8.3f\n", x, y );

            Point point = new Point( x, y );
            element.setLocation( point );

            angle += interval;
        }
    }

    static public void main( String[] args ) {
        List list = new LinkedList();
        list.add( new Element( "John" ) );
        list.add( new Element( "Paul" ) );
        list.add( new Element( "George" ) );
        list.add( new Element( "Ringo" ) );
        list.add( new Element( "Mick" ) );
        list.add( new Element( "Keith" ) );

        provideCircularLocations( list, 0.0 , 0.0, 1.0 );

        Iterator iterator = list.iterator();
        while ( iterator.hasNext() ) {
            Element element = ( Element ) iterator.next();
            Point point = element.getLocation();

            System.out.printf( "%8.3f %8.3f\n", point.getX(), point.getY() );

        }

    }
}
::::::::::::::
PathCombinationAnalyzer.java
::::::::::::::
import java.util.*;

/**
$Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
@author KISHI Yasuhiro
*/
public class PathCombinationAnalyzer {

    static public void dump( List pathCombination ) {

        Iterator iterator = pathCombination.iterator();
        while ( iterator.hasNext() ) {
            Stack path = ( Stack ) iterator.next();

            Enumeration enumeration = path.elements();
            while ( enumeration.hasMoreElements() ) {
                Element e = ( Element ) enumeration.nextElement();
                System.out.print( "[" + e.getName() + "] " );
            }

            System.out.println();
        }
    }

    /** 最短経路とその距離を求める */
    static public double getShortestPath ( List pathCombination ) {

        double min = Double.MAX_VALUE; // Doubleクラスが取り得る最大値

        Iterator iterator = pathCombination.iterator();
        while ( iterator.hasNext() ) {
            Stack stack = ( Stack ) iterator.next();

            // 経路単位で距離を計算する
            double totalDistance = 0.0;
            Enumeration enumeration = stack.elements();
            int i = 0;
            Point prev = null;
            Point next = null;
            while ( enumeration.hasMoreElements() ) {
                Element e = ( Element ) enumeration.nextElement();
                System.out.print( "[" + e.getName() + "] " );

                if ( i == 0 ) {
                    prev = e.getLocation();
                } else {
                    next = e.getLocation();
                    // 隣接する点の距離を求める
                    double distance = SmallWorldUtils.getDistance( prev, next );
                    // System.out.printf(" %8.3f ", distance);
                    totalDistance += distance;

                    prev = next;
                }

                i++;
            }
            System.out.printf( " // 距離=%6.3f ", totalDistance );
            System.out.println();

            if ( totalDistance < min ) {
                min = totalDistance;
            }
        }

        return min;
    }

    /** 最小ホップ数を求める */
    static public int getMinimunHopCount ( List pathCombination ) {

        int min = Integer.MAX_VALUE; // Integerクラスが取り得る最大値

        Iterator iterator = pathCombination.iterator();
        while ( iterator.hasNext() ) {
            Stack stack = ( Stack ) iterator.next();
            // System.out.println("size=" + stack.size());
            if ( stack.size() < min ) {
                min = stack.size();
            }
        }

        // 自身は含まないのでマイナス1する
        return min - 1;
    }
}
::::::::::::::
PathTraverser.java
::::::::::::::
import java.util.*;

/**
$Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
@author KISHI Yasuhiro
*/

public class PathTraverser {
    private List list;

    public PathTraverser( List list ) {
        this.list = list;
    }

    public void getAllPathsFrom( int from ) {
        Element fromElement = ( Element ) list.get( from );

        //=================================================
        // ある特定の要素から存在する経路を全走査
        //=================================================
        System.out.println();
        System.out.println();
        System.out.println( "///////////////////////////////////////////////////////////////////////////////////////" );
        System.out.println( fromElement.getName() + " から自身に戻るまでのPATH一覧 " );
        System.out.println( "///////////////////////////////////////////////////////////////////////////////////////" );
        System.out.println();

        Stack stack = new Stack();
        traverseAll( fromElement, stack, 0 );
    }

    /** 再帰メソッド */
    private void traverseAll( Element element, Stack stack, int depth ) {

        /* --- DEBUG用
               if ( depth > 5 ) {
                   return ;
               }
        */

        // スタック内に既に同一要素が存在する場合は先には進まない
        if ( !stack.contains( element ) ) {
            stack.push( element );
            printAll( stack );
        } else {
            return ;
        }

        List links = element.getLinks();
        Iterator iterator = links.iterator();
        while ( iterator.hasNext() ) {
            Element linkedElement = ( Element ) iterator.next();

            // indent( depth );
            // System.out.println( linkedElement.getName() );

            traverseAll( linkedElement, stack, depth + 1 );
        }

        stack.pop();

    }

    public List getAllPathsBetween( int from, int to ) {
        Element fromElement = ( Element ) list.get( from );
        Element toElement = ( Element ) list.get( to );

        //=================================================
        // from,toによりPATHを求める
        //=================================================
        List pathCombination = new LinkedList();

        // stack.setSize( 0 );	// スタックを空にする
        Stack stack = new Stack();
        retrievePaths( fromElement, toElement, stack, pathCombination );

        return pathCombination;
    }

    private void retrievePaths( Element element, Element toElement, Stack stack , List pathCombination ) {

        // スタック内に既に同一要素が存在する場合は先には進まない
        if ( !stack.contains( element ) ) {
            stack.push( element );
        } else {
            return ;
        }

        if ( element.equals( toElement ) ) {
            // 目的の要素に達した場合に実体コピーをリンクに追加
            pathCombination.add( ( Stack ) stack.clone() );
        }

        List links = element.getLinks();
        Iterator iterator = links.iterator();
        while ( iterator.hasNext() ) {
            Element linkedElement = ( Element ) iterator.next();

            // indent( depth );
            // System.out.println( linkedElement.getName() );

            retrievePaths( linkedElement, toElement, stack, pathCombination );
        }

        stack.pop();

    }

    private void indent( int depth ) {
        for ( int i = 0;i < depth;i++ ) {
            System.out.print( " " );
        }
    }

    private void printAll( Stack stack ) {

        Enumeration enumeration = stack.elements();
        while ( enumeration.hasMoreElements() ) {
            Element e = ( Element ) enumeration.nextElement();
            System.out.print( "[" + e.getName() + "] " );
        }
        System.out.println();

    }
}
::::::::::::::
Point.java
::::::::::::::
/**
$Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
*/
public class Point {
    private double x, y;

    public Point( double x, double y ) {
        this.x = x;
        this.y = y;
    }

    public double getX() {
        return x;
    }
    public double getY() {
        return y;
    }

    public void set
        ( double x, double y ) {
        this.x = x;
        this.y = y;
    }

    /** x,yの座標値を配列で返す */
    public double[] get
        () {
        double[] value = new double[ 2 ];

        value[ 0 ] = x;
        value[ 1 ] = y;
        return value;
    }

    public void add
        ( double deltaX, double deltaY ) {
        x += deltaX;
        y += deltaY;
    }
}
::::::::::::::
SmallWorldUtils.java
::::::::::::::
/**
$Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
@author KISHI Yasuhiro
*/
public class SmallWorldUtils {

    /** 2点間の距離を求める */
    static public double getDistance( double[] from , double[] to ) {
        return Math.sqrt(
                   ( from[ 0 ] - to[ 0 ] ) * ( from[ 0 ] - to[ 0 ] )
                   + ( from[ 1 ] - to[ 1 ] ) * ( from[ 1 ] - to[ 1 ] )
               );
    }

    /** 2点間の距離を求める */
    static public double getDistance( Point from , Point to ) {
        return Math.sqrt(
                   ( from.getX() - to.getX() ) * ( from.getX() - to.getX() )
                   + ( from.getY() - to.getY() ) * ( from.getY() - to.getY() )
               );
    }

    /** 線分の傾きを角度で返す
    * @param from 開始点
    * @param to 終了点
    * @return 角度
    */
    static double getAngle( double[] from , double[] to ) {
        double xDiff = to[ 0 ] - from[ 0 ];
        double yDiff = to[ 1 ] - from[ 1 ];

        // 傾きを得る
        double gradient = yDiff / xDiff;

        // DEGREE(度)で返す
        return Math.atan( gradient ) * 180.0 / Math.PI;
    }

    /** 角度をラジアンに変換して返す */
    static double degreeToRadian( double angle ) {

        return angle * Math.PI / 180.0;
    }

}
::::::::::::::
SmallWorldViewer.java
::::::::::::::
import javax.swing.*;

import java.awt.*;
import java.awt.event.*;

/**
* <pre>
* スモールワールドをシミュレーションするアプレット
* </pre>
* $Id: graphmodel.html,v 1.1 2009/06/22 16:12:11 kishi Exp kishi $
* @author KISHI Yasuhiro
*/

public class SmallWorldViewer extends JApplet {
    //-----------------------------------------------------------
}

戻る inserted by FC2 system