R绘制非重叠的最小生成树

R Plotting of a non-overlapping minimum spanning tree

我创建了一个最小生成树,其中使用 Louvain 方法找到了社区。我现在想清楚地显示树,即,有一个无重叠的表示会很棒。

左边是我现在的情节,右边是王等人的一个很好的例子。 (2017, JEIC),它更清晰,而且大部分不重叠。

我想知道如何才能更清楚地表示这棵树,特别需要注意的是,这种表示只是一个MWE,实际表示有更多的观察结果。

MWE:

library(igraph)
lstat <- c(4.98,9.14,4.03,2.94,5.33,5.21,12.43,19.15,29.93,17.1,20.45,13.27,15.71,8.26,10.26,8.47,6.58,14.67,11.69,11.28,21.02,13.83,18.72,19.88,16.3,16.51,14.81,17.28,12.8,11.98,22.6,13.04,27.71,18.35,20.34,9.68,11.41,8.77,10.13,4.32,1.98,4.84,5.81,7.44,9.55,10.21,14.15,18.8,30.81,16.2,13.45,9.43,5.28,8.43,14.8,4.81,5.77,3.95,6.86,9.22,13.15,14.44,6.73,9.5,8.05,4.67,10.24,8.1,13.09,8.79,6.72,9.88,5.52,7.54,6.78,8.94,11.97,10.27,12.34,9.1,5.29,7.22,6.72,7.51,9.62,6.53,12.86,8.44,5.5,5.7,8.81,8.2,8.16,6.21,10.59,6.65,11.34,4.21,3.57,6.19,9.42,7.67,10.63,13.44,12.33,16.47,18.66,14.09,12.27,15.55,13,10.16,16.21,17.09,10.45,15.76,12.04,10.3,15.37,13.61,14.37,14.27,17.93,25.41,17.58,14.81,27.26,17.19,15.39,18.34,12.6,12.26,11.12,15.03,17.31,16.96,16.9,14.59,21.32,18.46,24.16,34.41,26.82,26.42,29.29,27.8,16.65,29.53,28.32,21.45,14.1,13.28,12.12,15.79,15.12,15.02,16.14,4.59,6.43,7.39,5.5,1.73,1.92,3.32,11.64,9.81,3.7,12.14,11.1,11.32,14.43,12.03,14.69,9.04,9.64,5.33,10.11,6.29,6.92,5.04,7.56,9.45,4.82,5.68,13.98,13.15,4.45,6.68,4.56,5.39,5.1,4.69,2.87,5.03,4.38,2.97,4.08,8.61,6.62,4.56,4.45,7.43,3.11,3.81,2.88,10.87,10.97,18.06,14.66,23.09,17.27,23.98,16.03,9.38,29.55,9.47,13.51,9.69,17.92,10.5,9.71,21.46,9.93,7.6,4.14,4.63,3.13,6.36,3.92,3.76,11.65,5.25,2.47,3.95,8.05,10.88,9.54,4.73,6.36,7.37,11.38,12.4,11.22,5.19,12.5,18.46,9.16,10.15,9.52,6.56,5.9,3.59,3.53,3.54,6.57,9.25,3.11,5.12,7.79,6.9,9.59,7.26,5.91,11.25,8.1,10.45,14.79,7.44,3.16,13.65,13,6.59,7.73,6.58,3.53,2.98,6.05,4.16,7.19,4.85,3.76,4.59,3.01,3.16,7.85,8.23,12.93,7.14,7.6,9.51,3.33,3.56,4.7,8.58,10.4,6.27,7.39,15.84,4.97,4.74,6.07,9.5,8.67,4.86,6.93,8.93,6.47,7.53,4.54,9.97,12.64,5.98,11.72,7.9,9.28,11.5,18.33,15.94,10.36,12.73,7.2,6.87,7.7,11.74,6.12,5.08,6.15,12.79,9.97,7.34,9.09,12.43,7.83,5.68,6.75,8.01,9.8,10.56,8.51,9.74,9.29,5.49,8.65,7.18,4.61,10.53,12.67,6.36,5.99,5.89,5.98,5.49,7.79,4.5,8.05,5.57,17.6,13.27,11.48,12.67,7.79,14.19,10.19,14.64,5.29,7.12,14,13.33,3.26,3.73,2.96,9.53,8.88,34.77,37.97,13.44,23.24,21.24,23.69,21.78,17.21,21.08,23.6,24.56,30.63,30.81,28.28,31.99,30.62,20.85,17.11,18.76,25.68,15.17,16.35,17.12,19.37,19.92,30.59,29.97,26.77,20.32,20.31,19.77,27.38,22.98,23.34,12.13,26.4,19.78,10.11,21.22,34.37,20.08,36.98,29.05,25.79,26.64,20.62,22.74,15.02,15.7,14.1,23.29,17.16,24.39,15.69,14.52,21.52,24.08,17.64,19.69,12.03,16.22,15.17,23.27,18.05,26.45,34.02,22.88,22.11,19.52,16.59,18.85,23.79,23.98,17.79,16.44,18.13,19.31,17.44,17.73,17.27,16.74,18.71,18.13,19.01,16.94,16.23,14.7,16.42,14.65,13.99,10.29,13.22,14.13,17.15,21.32,18.13,14.76,16.29,12.87,14.36,11.66,18.14,24.1,18.68,24.91,18.03,13.11,10.74,7.74,7.01,10.42,13.34,10.58,14.98,11.45,18.06,23.97,29.68,18.07,13.35,12.01,13.59,17.6,21.14,14.1,12.92,15.1)
rm <- c(6.575,6.421,7.185,6.998,7.147,6.43,6.012,6.172,5.631,6.004,6.377,6.009,5.889,5.949,6.096,5.834,5.935,5.99,5.456,5.727,5.57,5.965,6.142,5.813,5.924,5.599,5.813,6.047,6.495,6.674,5.713,6.072,5.95,5.701,6.096,5.933,5.841,5.85,5.966,6.595,7.024,6.77,6.169,6.211,6.069,5.682,5.786,6.03,5.399,5.602,5.963,6.115,6.511,5.998,5.888,7.249,6.383,6.816,6.145,5.927,5.741,5.966,6.456,6.762,7.104,6.29,5.787,5.878,5.594,5.885,6.417,5.961,6.065,6.245,6.273,6.286,6.279,6.14,6.232,5.874,6.727,6.619,6.302,6.167,6.389,6.63,6.015,6.121,7.007,7.079,6.417,6.405,6.442,6.211,6.249,6.625,6.163,8.069,7.82,7.416,6.727,6.781,6.405,6.137,6.167,5.851,5.836,6.127,6.474,6.229,6.195,6.715,5.913,6.092,6.254,5.928,6.176,6.021,5.872,5.731,5.87,6.004,5.961,5.856,5.879,5.986,5.613,5.693,6.431,5.637,6.458,6.326,6.372,5.822,5.757,6.335,5.942,6.454,5.857,6.151,6.174,5.019,5.403,5.468,4.903,6.13,5.628,4.926,5.186,5.597,6.122,5.404,5.012,5.709,6.129,6.152,5.272,6.943,6.066,6.51,6.25,7.489,7.802,8.375,5.854,6.101,7.929,5.877,6.319,6.402,5.875,5.88,5.572,6.416,5.859,6.546,6.02,6.315,6.86,6.98,7.765,6.144,7.155,6.563,5.604,6.153,7.831,6.782,6.556,7.185,6.951,6.739,7.178,6.8,6.604,7.875,7.287,7.107,7.274,6.975,7.135,6.162,7.61,7.853,8.034,5.891,6.326,5.783,6.064,5.344,5.96,5.404,5.807,6.375,5.412,6.182,5.888,6.642,5.951,6.373,6.951,6.164,6.879,6.618,8.266,8.725,8.04,7.163,7.686,6.552,5.981,7.412,8.337,8.247,6.726,6.086,6.631,7.358,6.481,6.606,6.897,6.095,6.358,6.393,5.593,5.605,6.108,6.226,6.433,6.718,6.487,6.438,6.957,8.259,6.108,5.876,7.454,8.704,7.333,6.842,7.203,7.52,8.398,7.327,7.206,5.56,7.014,8.297,7.47,5.92,5.856,6.24,6.538,7.691,6.758,6.854,7.267,6.826,6.482,6.812,7.82,6.968,7.645,7.923,7.088,6.453,6.23,6.209,6.315,6.565,6.861,7.148,6.63,6.127,6.009,6.678,6.549,5.79,6.345,7.041,6.871,6.59,6.495,6.982,7.236,6.616,7.42,6.849,6.635,5.972,4.973,6.122,6.023,6.266,6.567,5.705,5.914,5.782,6.382,6.113,6.426,6.376,6.041,5.708,6.415,6.431,6.312,6.083,5.868,6.333,6.144,5.706,6.031,6.316,6.31,6.037,5.869,5.895,6.059,5.985,5.968,7.241,6.54,6.696,6.874,6.014,5.898,6.516,6.635,6.939,6.49,6.579,5.884,6.728,5.663,5.936,6.212,6.395,6.127,6.112,6.398,6.251,5.362,5.803,8.78,3.561,4.963,3.863,4.97,6.683,7.016,6.216,5.875,4.906,4.138,7.313,6.649,6.794,6.38,6.223,6.968,6.545,5.536,5.52,4.368,5.277,4.652,5,4.88,5.39,5.713,6.051,5.036,6.193,5.887,6.471,6.405,5.747,5.453,5.852,5.987,6.343,6.404,5.349,5.531,5.683,4.138,5.608,5.617,6.852,5.757,6.657,4.628,5.155,4.519,6.434,6.782,5.304,5.957,6.824,6.411,6.006,5.648,6.103,5.565,5.896,5.837,6.202,6.193,6.38,6.348,6.833,6.425,6.436,6.208,6.629,6.461,6.152,5.935,5.627,5.818,6.406,6.219,6.485,5.854,6.459,6.341,6.251,6.185,6.417,6.749,6.655,6.297,7.393,6.728,6.525,5.976,5.936,6.301,6.081,6.701,6.376,6.317,6.513,6.209,5.759,5.952,6.003,5.926,5.713,6.167,6.229,6.437,6.98,5.427,6.162,6.484,5.304,6.185,6.229,6.242,6.75,7.061,5.762,5.871,6.312,6.114,5.905,5.454,5.414,5.093,5.983,5.983,5.707,5.926,5.67,5.39,5.794,6.019,5.569)
dis <- c(4.09,4.9671,4.9671,6.0622,6.0622,6.0622,5.5605,5.9505,6.0821,6.5921,6.3467,6.2267,5.4509,4.7075,4.4619,4.4986,4.4986,4.2579,3.7965,3.7965,3.7979,4.0123,3.9769,4.0952,4.3996,4.4546,4.682,4.4534,4.4547,4.239,4.233,4.175,3.99,3.7872,3.7598,3.3603,3.3779,3.9342,3.8473,5.4011,5.4011,5.7209,5.7209,5.7209,5.7209,5.1004,5.1004,5.6894,5.87,6.0877,6.8147,6.8147,6.8147,6.8147,7.3197,8.6966,9.1876,8.3248,7.8148,6.932,7.2254,6.8185,7.2255,7.9809,9.2229,6.6115,6.6115,6.498,6.498,6.498,5.2873,5.2873,5.2873,5.2873,4.2515,4.5026,4.0522,4.0905,5.0141,4.5026,5.4007,5.4007,5.4007,5.4007,4.7794,4.4377,4.4272,3.7476,3.4217,3.4145,3.0923,3.0921,3.6659,3.6659,3.615,3.4952,3.4952,3.4952,3.4952,3.4952,2.7778,2.8561,2.7147,2.7147,2.421,2.1069,2.211,2.1224,2.4329,2.5451,2.7778,2.6775,2.3534,2.548,2.2565,2.4631,2.7301,2.7474,2.4775,2.7592,2.2577,2.1974,2.0869,1.9444,2.0063,1.9929,1.7572,1.7883,1.8125,1.9799,2.1185,2.271,2.3274,2.4699,2.346,2.1107,1.9669,1.8498,1.6686,1.6687,1.6119,1.4394,1.3216,1.4118,1.3459,1.4191,1.5166,1.4608,1.5296,1.5257,1.618,1.5916,1.6102,1.6232,1.7494,1.7455,1.7364,1.8773,1.7573,1.7659,1.7984,1.9709,2.0407,2.162,2.422,2.2834,2.0459,2.4259,2.1,2.2625,2.4259,2.3887,2.5961,2.6463,2.7019,3.1323,3.5549,3.3175,2.9153,2.829,2.741,2.5979,2.7006,2.847,2.9879,3.2797,3.1992,3.7886,4.5667,4.5667,6.4798,6.4798,6.4798,6.2196,6.2196,5.6484,7.309,7.309,7.309,7.6534,7.6534,6.27,6.27,5.118,5.118,3.9454,4.3549,4.3549,4.2392,3.875,3.8771,3.665,3.6526,3.9454,3.5875,3.9454,3.1121,3.4211,2.8893,3.3633,2.8617,3.048,3.2721,3.2721,2.8944,2.8944,3.2157,3.2157,3.3751,3.3751,3.6715,3.6715,3.8384,3.6519,3.6519,3.6519,4.148,4.148,6.1899,6.1899,6.3361,6.3361,7.0355,7.0355,7.9549,7.9549,8.0555,8.0555,7.8265,7.8265,7.3967,7.3967,8.9067,8.9067,9.2203,9.2203,6.3361,1.801,1.8946,2.0107,2.1121,2.1398,2.2885,2.0788,1.9301,1.9865,2.1329,2.4216,2.872,3.9175,4.429,4.429,3.9175,4.3665,4.0776,4.2673,4.7872,4.8628,4.1403,4.1007,4.6947,5.2447,5.2119,5.885,7.3073,7.3073,9.0892,7.3172,7.3172,7.3172,5.1167,5.1167,5.1167,5.5027,5.5027,5.9604,5.9604,6.32,7.8278,7.8278,7.8278,5.4917,5.4917,5.4917,4.022,3.37,3.0992,3.1827,3.3175,3.1025,2.5194,2.6403,2.834,3.2628,3.6023,3.945,3.9986,4.0317,3.5325,4.0019,4.5404,4.5404,4.7211,4.7211,4.7211,5.4159,5.4159,5.4159,5.2146,5.2146,5.8736,6.6407,6.6407,6.4584,6.4584,5.9853,5.2311,5.615,4.8122,4.8122,4.8122,7.0379,6.2669,5.7321,6.4654,8.0136,8.0136,8.5353,8.344,8.7921,8.7921,10.7103,10.7103,12.1265,10.5857,10.5857,2.1222,2.5052,2.7227,2.5091,2.5182,2.2955,2.1036,1.9047,1.9047,1.6132,1.7523,1.5106,1.3325,1.3567,1.2024,1.1691,1.1296,1.1742,1.137,1.3163,1.3449,1.358,1.3861,1.3861,1.4165,1.5192,1.5804,1.5331,1.4395,1.4261,1.4672,1.5184,1.5895,1.7281,1.9265,2.1678,1.77,1.7912,1.7821,1.7257,1.6768,1.6334,1.4896,1.5004,1.5888,1.5741,1.639,1.7028,1.6074,1.4254,1.1781,1.2852,1.4547,1.4655,1.413,1.5275,1.5539,1.5894,1.6582,1.8347,1.8195,1.6475,1.8026,1.794,1.8589,1.8746,1.9512,2.0218,2.0635,1.9096,1.9976,1.8629,1.9356,1.9682,2.0527,2.0882,2.2004,2.3158,2.2222,2.1247,2.0026,1.9142,1.8206,1.8172,1.8662,2.0651,2.0048,1.9784,1.8956,1.9879,2.072,2.198,2.2616,2.185,2.3236,2.3552,2.3682,2.4527,2.4961,2.4358,2.5806,2.7792,2.7831,2.7175,2.5975,2.5671,2.7344,2.8016,2.9634,3.0665,2.8715,2.5403,2.9084,2.8237,3.0334,3.0993,2.8965,2.5329,2.4298,2.206,2.3053,2.1007,2.1705,1.9512,3.4242,3.3317,3.4106,4.0983,3.724,3.9917,3.5459,3.1523,1.8209,1.7554,1.8226,1.8681,2.1099,2.3817,2.3817,2.7986,2.7986,2.8927,2.4091,2.3999)
indus <- c(2.31,7.07,7.07,2.18,2.18,2.18,7.87,7.87,7.87,7.87,7.87,7.87,7.87,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,8.14,5.96,5.96,5.96,5.96,2.95,2.95,6.91,6.91,6.91,6.91,6.91,6.91,6.91,6.91,6.91,5.64,5.64,5.64,5.64,4,1.22,0.74,1.32,5.13,5.13,5.13,5.13,5.13,5.13,1.38,3.37,3.37,6.07,6.07,6.07,10.81,10.81,10.81,10.81,12.83,12.83,12.83,12.83,12.83,12.83,4.86,4.86,4.86,4.86,4.49,4.49,4.49,4.49,3.41,3.41,3.41,3.41,15.04,15.04,15.04,2.89,2.89,2.89,2.89,2.89,8.56,8.56,8.56,8.56,8.56,8.56,8.56,8.56,8.56,8.56,8.56,10.01,10.01,10.01,10.01,10.01,10.01,10.01,10.01,10.01,25.65,25.65,25.65,25.65,25.65,25.65,25.65,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,21.89,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,19.58,4.05,4.05,4.05,4.05,4.05,4.05,4.05,2.46,2.46,2.46,2.46,2.46,2.46,2.46,2.46,3.44,3.44,3.44,3.44,3.44,3.44,2.93,2.93,0.46,1.52,1.52,1.52,1.47,1.47,2.03,2.03,2.68,2.68,10.59,10.59,10.59,10.59,10.59,10.59,10.59,10.59,10.59,10.59,10.59,13.89,13.89,13.89,13.89,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,6.2,4.93,4.93,4.93,4.93,4.93,4.93,5.86,5.86,5.86,5.86,5.86,5.86,5.86,5.86,5.86,5.86,3.64,3.64,3.75,3.97,3.97,3.97,3.97,3.97,3.97,3.97,3.97,3.97,3.97,3.97,3.97,6.96,6.96,6.96,6.96,6.96,6.41,6.41,6.41,6.41,6.41,3.33,3.33,3.33,3.33,1.21,2.97,2.25,1.76,5.32,5.32,5.32,4.95,4.95,4.95,13.92,13.92,13.92,13.92,13.92,2.24,2.24,2.24,6.09,6.09,6.09,2.18,2.18,2.18,2.18,9.9,9.9,9.9,9.9,9.9,9.9,9.9,9.9,9.9,9.9,9.9,9.9,7.38,7.38,7.38,7.38,7.38,7.38,7.38,7.38,3.24,3.24,3.24,6.06,6.06,5.19,5.19,5.19,5.19,5.19,5.19,5.19,5.19,1.52,1.89,3.78,3.78,4.39,4.39,4.15,2.01,1.25,1.25,1.69,1.69,2.02,1.91,1.91,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,18.1,27.74,27.74,27.74,27.74,27.74,9.69,9.69,9.69,9.69,9.69,9.69,9.69)
from <- c(402,155,168,430,449,431,357,121,382,200,391,422,89,214,378,458,442,443,145,394,169,386,459,437,447,451,180,434,455,105,14,430,321,460,259,68,291,123,444,162,192,465,449,404,117,460,25,165,116,131,406,143,397,364,357,463,128,136,353,447,398,394,434,337,409,76,462,104,340,350,432,392,191,113,395,386,37,221,288,66,459,18,359,401,383,362,392,19,426,358,118,193,444,119,63,377,121,197,489,120,385,272,445,424,247,82,402,401,421,362,384,29,115,364,239,456,394,154,424,128,484,275,82,381,481,52,191,164,224,358,120,59,206,23,380,91,130,259,189,390,40,374,301,453,98,229,396,7,410,360,24,54,96,396,54,165,420,383,321,313,147,36,463,429,192,395,81,43,225,379,495,69,4,98,412,57,37,112,469,352,449,42,384,248,429,325,232,310,403,272,64,398,367,357,53,5,299,372,399,51,433,52,51,249,53,105,358,401,180,3,205,454,360,114,204,260,372,225,240,63,339,382,213,239,90,440,230,482,363,214,154,129,189,273,82,196,190,200,91,22,464,359,85,39,174,250,40,270,481,208,302,71,465,262,330,84,337,370,470,218,89,100,21,52,29,6,18,42,53,104,393,227,235,361,26,349,272,241,151,58,179,96,210,417,183,113,178,17,281,151,208,2,14,159,206,227,43,203,494,89,129,39,255,274,393,258,178,45,175,223,311,45,278,275,145,77,285,54,56,185,310,305,198,181,1,159,8,12,206,238,36,182,146,106,151,83,130,174,305,51,271,199,175,296,56,82,329,498,400,132,229,158,200,44,153,313,286,375,70,95,5,38,61,22,111,89,84,23,38,386,13,257,143,19,152,228,61,7,408,61,13,81,71,292,86,101,387,78,211,15,41,91,88,13,202,55,99,47,277,316,241,376,253,28,367,88,166,78,158,9,4,294,363,116,243,99,59,8,413,110,67,22,72,15,314,85,10,64,383,155,144,20,209,102,163,173,331,76,263,129,252,150,21,261,107,309,97,77,160,352,369,173,78,148,53,158,57,361,21,97,124,256,93,93,65,65,131,87,312,8,123,77,75,21,74,388,71,122,374,133,139,167,210,48,124,125,139,287,366,95,9,33,127,211,125,142,79,124,33,1)
to <- c(403,156,172,446,479,447,431,122,412,201,425,427,90,216,412,467,450,448,148,421,170,399,471,447,479,452,183,448,477,109,16,476,322,462,265,333,292,125,477,163,345,472,456,414,313,470,26,172,119,132,440,144,442,428,453,473,137,137,355,452,404,435,461,340,418,80,473,111,341,351,442,477,192,116,443,389,231,223,289,192,461,27,488,438,445,463,457,20,476,465,310,257,450,500,288,379,126,201,492,495,389,322,476,436,249,84,419,409,428,428,426,32,118,423,335,477,422,157,445,135,486,276,83,396,486,60,194,167,235,480,498,288,207,34,429,92,140,262,280,419,282,413,349,467,187,234,431,328,432,472,35,68,188,443,70,170,436,406,323,494,157,39,466,468,195,422,293,327,226,446,499,332,203,99,429,351,236,115,475,356,469,326,478,249,441,327,238,319,410,325,290,402,423,391,334,6,300,373,400,69,474,290,61,290,244,111,463,405,184,278,283,461,433,496,281,262,411,234,335,335,341,402,318,334,100,441,275,483,411,315,155,138,282,279,240,284,280,300,174,32,481,433,340,236,175,251,195,271,488,317,303,74,485,268,344,336,338,371,487,220,176,307,35,70,30,194,22,304,251,108,478,229,273,482,28,351,279,243,171,201,260,100,212,438,187,114,179,322,283,156,211,45,323,161,316,233,326,284,499,280,134,237,348,277,409,263,188,46,177,237,494,302,304,278,149,79,286,336,58,186,315,307,286,308,280,160,48,328,319,278,38,306,149,110,152,86,135,261,308,62,328,301,266,297,350,344,331,500,416,133,230,161,342,323,172,316,343,415,303,220,342,235,347,270,499,184,339,24,339,388,27,283,146,324,153,232,245,324,433,242,25,334,73,293,188,103,405,80,213,20,283,182,339,50,343,62,281,270,325,320,242,480,254,34,368,92,169,220,167,49,193,297,464,213,346,269,348,11,439,500,331,104,216,46,315,329,50,346,407,394,409,103,318,314,164,267,343,294,268,137,253,390,31,264,496,312,177,78,361,354,370,185,295,400,252,370,352,373,497,186,127,346,218,94,353,198,138,242,314,23,492,217,296,222,314,439,75,493,415,170,150,365,497,246,490,126,141,347,373,481,33,215,491,219,135,413,298,141,212,1)
distance <- c(0.0896270606457671,0.102685003773676,0.116158684565556,0.128953828946641,0.135274572629151,0.151398447812385,0.157880492778557,0.177741638340598,0.179479497436337,0.194164878389476,0.207781134851073,0.209260603076643,0.212687188142587,0.212953046467995,0.218858972856952,0.229946276334275,0.242068192871348,0.246678414134678,0.26707865882545,0.273143350642113,0.285823809365141,0.288804864917473,0.29018285614419,0.294646160674123,0.302718103191734,0.306487454881924,0.309049445882046,0.310647452910853,0.311192287822176,0.313034518863336,0.317748658533754,0.323222585844492,0.333766385365573,0.334880814619171,0.336881655778405,0.341719607280588,0.367789341879288,0.368402442988644,0.368462494699258,0.372747957740884,0.374743058641518,0.375990438708222,0.382028323557299,0.382877996233786,0.385621848447412,0.387688586367977,0.390832444917257,0.392281646269615,0.394263059390555,0.395322969228958,0.408219597765713,0.415163871260493,0.416266609278236,0.418746032817029,0.420286806835524,0.42139816088825,0.421899229674577,0.422761682275014,0.424695373179413,0.427081069587496,0.430952851249415,0.431260941890174,0.435407728456904,0.438786064044883,0.439022596229398,0.441977374986548,0.443086176719609,0.448269572913442,0.450320996623521,0.457931217542548,0.460176716055909,0.461297355292657,0.461566896559967,0.463421072028453,0.466282414422847,0.46947690039021,0.470107391986129,0.471181663480233,0.472055081531806,0.473546080123149,0.480153475463835,0.480405880480246,0.484499907120734,0.485293890338628,0.486389802524682,0.486815375681582,0.488394144109038,0.491468208534387,0.492655011138626,0.497034445486427,0.499496756746228,0.500525413940191,0.5088295981957,0.522619134743457,0.523084973976504,0.52588823907747,0.526474158910009,0.530203130884758,0.531195670163076,0.53228869046787,0.533614092767423,0.534514695775523,0.536015074414891,0.536343555941525,0.53634503819836,0.537032587465602,0.539637146608719,0.540169241997358,0.541938188357307,0.546300064067359,0.558594888984852,0.561035729699989,0.563712524253275,0.563726219010612,0.566597961521219,0.566755017622253,0.568176521866223,0.571212079704203,0.572649491399407,0.574042933934387,0.582635014395806,0.589662691714509,0.592021114488326,0.592210807061134,0.593764473507804,0.594393211603228,0.596242433914259,0.597323371382704,0.598675237503608,0.6000599970003,0.603565447983895,0.605146065012407,0.605735296973851,0.606108150415418,0.608646243724547,0.61011805415018,0.61273276393547,0.613181897971556,0.615542037557144,0.616392123570703,0.617162831025978,0.617621316018161,0.617623218475472,0.621880929117464,0.621900313555155,0.626290060594929,0.626464683761184,0.629007281356901,0.62945713912863,0.634054445611731,0.635753222563599,0.639139178896115,0.643531320139121,0.649846758859349,0.653886756250652,0.654327326343628,0.654436773111048,0.655769776674712,0.656412591286913,0.657747132262848,0.659657517201159,0.663896076204703,0.664269832221816,0.664651856237534,0.664927845709593,0.667246019096407,0.668030687917853,0.670801013714202,0.671402263922308,0.672684353913482,0.676978404382296,0.684548968299566,0.684926886609075,
              0.686732116621904,0.686907279041357,0.687072958280269,0.688186747910768,0.688376350552516,0.69149039038876,0.695538755210664,0.69672895734281,0.697456808698575,0.700946331754437,0.701562541759465,0.702524988879399,0.703033455818427,0.707367125331676,0.710703876449255,0.7153364592973,0.716412876768696,0.717987945581261,0.720230858822363,0.72026815145472,0.726222755082765,0.726274527985113,0.726972489163105,0.733018417231109,0.735079077378753,0.737372117726187,0.742266724297944,0.745306145151105,0.750870328352372,0.753696550343704,0.753996346144993,0.758206198866773,0.759598736175884,0.759616113573166,0.761828038339362,0.764076566843926,0.769583972026445,0.774298527701042,0.776035463107195,0.776443616755267,0.776778192278852,0.777992217184722,0.778428423170685,0.77882489045998,0.781196038136395,0.782117798033008,0.783427348258918,0.785290392148025,0.788300710389124,0.79280628781563,0.793295184657011,0.79409161310267,0.794847155118517,0.795576677637046,0.797399655129095,0.799595747862631,0.800425892884531,0.800766158126079,0.80119928232619,0.801516063469722,0.804285919309794,0.80647730284243,0.810483534687781,0.812394608549318,0.812447758320497,0.81327547608421,0.813646292930781,0.814599140682091,0.814924100760309,0.81773580085502,0.820171421106588,0.820573189910566,0.820785623655775,0.820989189941013,0.82959523262854,0.831624079737954,0.832532696054635,0.835419056521935,0.83784485437341,0.840925894475845,0.845896116553328,0.84662580281964,0.847087457114081,0.851853983966736,0.852993253197234,0.854853110189113,0.855454171770762,0.857189220650843,0.859844171928844,0.860539139144757,0.86469583669635,0.866583804372088,0.869813060375619,0.875525190956834,0.87765405485305,0.878692210048547,0.879442601879168,0.879821851285815,0.880241080613714,0.886502882116014,0.887798541336941,0.890845351337705,0.894158045314138,0.896890009978928,0.897374704345961,0.906979277602305,0.908316552750196,0.908529118960972,0.915030600581205,0.916406023550697,0.917315698110525,0.917865981502746,0.918863515436323,0.92503504798467,0.926244157876314,0.927696523654153,0.929277272938492,0.940064806276673,0.94117928153992,0.948603689640727,0.948917915311962,0.952678413736766,0.954758760106447,0.956801442306605,0.959736422149331,0.962390128793932,0.963309918977273,0.965741041894773,0.968682347315157,0.969478725914087,0.969620797012935,0.977432908183472,0.977441686240157,0.981949189113164,0.985083372106138,0.98713220999013,0.990355900674096,0.999358439199871,0.999436661324769,1.00610695753483,1.00899110005986,1.02700277020074,
              1.03167854005015,1.03248486671718,1.03359825851247,1.03697841829037,1.03703820566072,1.03919441876869,1.04738523953701,1.05119878709976,1.05520371966744,1.05526465400865,1.05773813394431,1.06416033096522,1.06459975577679,1.07133907330966,1.07840764092249,1.07905060585683,1.08061205342158,1.08339570333281,1.08687774841515,1.09023894628655,1.09906915160057,1.0996950531852,1.10165268574084,1.10190448315632,1.11365319556853,1.11624397422786,1.11913468358371,1.12414330047374,1.1274045414136,1.12806039288683,1.13302910818743,1.1335153285245,1.13731123268875,1.13880660781363,1.14232086560651,1.14523185425485,1.1465488258247,1.14760457039871,1.14760622166316,1.1694384336082,1.17636941476732,1.18152492991049,1.18190965813805,1.18302142415089,1.18715158678241,1.19248752194729,1.19292467909755,1.19327626306736,1.19825374608219,1.20424901494666,1.2092626224274,1.21115492402913,1.21154277266632,1.21452253993082,1.21558557493909,1.21650450471833,1.21930580249583,1.22410589819672,1.22412791815235,1.22458562787581,1.22550179110436,1.2286066294791,1.23012534320694,1.23088587610712,1.23234349513437,1.23590318795608,1.24444778516417,1.25056147389882,1.25216772039532,1.25277085294957,1.2537007657332,1.26581872319855,1.26865377861732,1.26941295487323,1.27252432589715,1.27543625477716,1.27712973499171,1.27754340826447,1.28436102401155,1.28487104800443,1.28987807175717,1.29170439729839,1.29217197384868,1.29463246135728,1.29715134429256,1.29753766804667,1.29886643270199,1.30203840189143,1.30707246929924,1.31046514261158,1.31694200707548,1.32108272261808,1.32650248397807,1.33892567381464,1.33970534446945,1.34137606956439,1.34300904315645,1.34981665421642,1.3560424956468,1.35746661469076,1.35844699565349,1.36644108910703,1.37440876015835,1.37908588927593,1.39143201055603,1.418219098024,1.42893308450746,1.43737142381501,1.44723123584312,1.45267382780857,1.46486860844241,1.4654771782597,1.47277740680661,1.47778526518571,1.48281598318874,1.48823432630752,1.49294180730529,1.49568721663321,1.50967873734778,1.5175779024485,1.51997310502522,1.52564769524291,1.53074524660376,1.53909603663969,1.5946975763448,1.59783009109229,1.62302641999445,1.64504133990608,1.66495792439329,1.66533172671393,1.67193565665668,1.69779653963601,1.70610312994262,1.71140272583632,1.76545275779331,1.77647252722917,1.78514179828942,1.79345193412034,1.80084540147121,1.80237426745945,1.80793372666146,1.82700062671035,1.84115153097185,1.85685230699698,1.87284282575981,1.87525807290623,1.9173077191729,1.93992964820892,1.96363464015076,1.96582266748555,1.99905532939936,2.00806267083475,2.01382700597643,2.02352223857313,2.03808659286106,2.10619501471255,2.1288186888507,2.12898196563522,2.20734818504014,2.24871991363976,2.25531590691859,2.27543790071274,2.28530025379599,2.29523963890483,2.31974395354315,2.3325994962702,2.3372287949621,2.40275944696925,2.55562423881133,2.58317343591173,2.77209822336799,2.85819941396677,2.8725666850397,2.94721308357574,3.0696178328906,3.07895167386563,3.13680573992079,3.24024337974788,3.50547141480287,3.7869222450428,3.81204554668488,3.91648296434441,3.98895728856552,4.50767578692168,0)

df <- cbind.data.frame(lstat, rm, dis, indus, from, to, distance)
DistMat <- as.matrix(dist(df[ ,1:4], diag = T, upper = T))

g <- graph.data.frame(df[, 5:6], directed = FALSE)
lou <- cluster_louvain(g)
set.seed(0)
plot(lou, g, vertex.label = NA, vertex.size = 5, mark.groups = NULL)

首先,您的顶点比“漂亮”图中的顶点大得多。我将使用较小的节点大小。但要点是您应该指定布局。两个值得尝试的选项是 layout_as_treelayout_with_gem。这是我得到的。

par(mfrow=c(1,2))
set.seed(20210401)
LOWG = layout_with_gem(g)
plot(lou, g, layout = LOWG, vertex.label = NA, 
    vertex.size = 2.5, mark.groups = NULL, main="GEM")
LOAT = layout_as_tree(g)
plot(lou, g, layout = LOAT, vertex.label = NA, 
    vertex.size = 2.5, mark.groups = NULL, main="TREE")

根据OP评论添加:

OP 注意到在创建图表时没有使用距离。使用距离取决于您的应用程序,但在图形显示中使用它的最明显方式是在顶点布局中。您可能希望布局反映这些距离。这是一种方法。

您只提供边长,因此我们没有所有顶点之间的完整距离矩阵,但我们可以计算任意两个节点之间的最短加权路径的长度,并将其用作它们之间的距离。然后我们可以使用 multi-dimensional 缩放以接近这些距离的方式布置顶点。这是示例图上的结果。

DistMat = distances(g, weights=distance)
set.seed(0)
LOMDS = layout_with_mds(g, dist=DistMat)
plot(lou, g, layout=LOMDS, vertex.label = NA, 
    vertex.size = 2.5, mark.groups = NULL, main="MDS")