Implements the stub edge bundling by Nocaj and Brandes
Arguments
- object
a graph object (igraph/tbl_graph). Does not support network objects
- xy
coordinates of vertices
- alpha
maximal angle (in degree) between consecutive edges in a bundle
- beta
angle (in degree) at which to connect two stubs
- gamma
maximal overall angle (in degree) of an edge bundle
- t
numeric between 0 and 1. control point location
- tshift
numeric between 0 and 1. The closer to one, the longer the bigger bundle
Details
see online for plotting tips
References
Nocaj, Arlind, and Ulrik Brandes. "Stub bundling and confluent spirals for geographic networks." International Symposium on Graph Drawing. Springer, Cham, 2013.
Examples
library(igraph)
g <- graph.star(10, "undirected")
xy <- matrix(c(
0, 0,
cos(90 * pi / 180), sin(90 * pi / 180),
cos(80 * pi / 180), sin(80 * pi / 180),
cos(70 * pi / 180), sin(70 * pi / 180),
cos(330 * pi / 180), sin(330 * pi / 180),
cos(320 * pi / 180), sin(320 * pi / 180),
cos(310 * pi / 180), sin(310 * pi / 180),
cos(210 * pi / 180), sin(210 * pi / 180),
cos(200 * pi / 180), sin(200 * pi / 180),
cos(190 * pi / 180), sin(190 * pi / 180)
), ncol = 2, byrow = TRUE)
edge_bundle_stub(g, xy)
#> x y index group
#> 1 0.000000e+00 0.0000000 0.0000000 1.1
#> 2 5.430910e-02 0.3080022 0.1428571 1.1
#> 3 1.086182e-01 0.6160044 0.2857143 1.1
#> 4 5.430910e-02 0.6205022 0.4285714 1.1
#> 5 6.123234e-17 1.0000000 0.5714286 1.2
#> 6 4.975128e-17 0.8125000 0.7142857 1.2
#> 7 3.827021e-17 0.6250000 0.8571429 1.2
#> 8 5.430910e-02 0.6205022 1.0000000 1.2
#> 9 0.000000e+00 0.0000000 0.0000000 2.1
#> 10 5.426506e-02 0.3077524 0.1428571 2.1
#> 11 1.085301e-01 0.6155048 0.2857143 2.1
#> 12 1.085301e-01 0.6155048 0.4285714 2.1
#> 13 1.736482e-01 0.9848078 0.5714286 2.2
#> 14 1.410891e-01 0.8001563 0.7142857 2.2
#> 15 1.085301e-01 0.6155048 0.8571429 2.2
#> 16 1.085301e-01 0.6155048 1.0000000 2.2
#> 17 0.000000e+00 0.0000000 0.0000000 3.1
#> 18 5.430910e-02 0.3080022 0.1428571 3.1
#> 19 1.086182e-01 0.6160044 0.2857143 3.1
#> 20 1.611904e-01 0.6016561 0.4285714 3.1
#> 21 3.420201e-01 0.9396926 0.5714286 3.2
#> 22 2.778914e-01 0.7635003 0.7142857 3.2
#> 23 2.137626e-01 0.5873079 0.8571429 3.2
#> 24 1.611904e-01 0.6016561 1.0000000 3.2
#> 25 0.000000e+00 0.0000000 0.0000000 4.1
#> 26 2.395832e-01 -0.2010342 0.1428571 4.1
#> 27 4.791663e-01 -0.4020683 0.2857143 4.1
#> 28 5.102161e-01 -0.3572842 0.4285714 4.1
#> 29 8.660254e-01 -0.5000000 0.5714286 4.2
#> 30 7.036456e-01 -0.4062500 0.7142857 4.2
#> 31 5.412659e-01 -0.3125000 0.8571429 4.2
#> 32 5.102161e-01 -0.3572842 1.0000000 4.2
#> 33 0.000000e+00 0.0000000 0.0000000 5.1
#> 34 2.393889e-01 -0.2008711 0.1428571 5.1
#> 35 4.787778e-01 -0.4017423 0.2857143 5.1
#> 36 4.787778e-01 -0.4017423 0.4285714 5.1
#> 37 7.660444e-01 -0.6427876 0.5714286 5.2
#> 38 6.224111e-01 -0.5222649 0.7142857 5.2
#> 39 4.787778e-01 -0.4017423 0.8571429 5.2
#> 40 4.787778e-01 -0.4017423 1.0000000 5.2
#> 41 0.000000e+00 0.0000000 0.0000000 6.1
#> 42 2.395832e-01 -0.2010342 0.1428571 6.1
#> 43 4.791663e-01 -0.4020683 0.2857143 6.1
#> 44 4.404543e-01 -0.4404230 0.4285714 6.1
#> 45 6.427876e-01 -0.7660444 0.5714286 6.2
#> 46 5.222649e-01 -0.6224111 0.7142857 6.2
#> 47 4.017423e-01 -0.4787778 0.8571429 6.2
#> 48 4.404543e-01 -0.4404230 1.0000000 6.2
#> 49 0.000000e+00 0.0000000 0.0000000 7.1
#> 50 -2.938923e-01 -0.1069680 0.1428571 7.1
#> 51 -5.877845e-01 -0.2139361 0.2857143 7.1
#> 52 -5.645252e-01 -0.2632180 0.4285714 7.1
#> 53 -8.660254e-01 -0.5000000 0.5714286 7.2
#> 54 -7.036456e-01 -0.4062500 0.7142857 7.2
#> 55 -5.412659e-01 -0.3125000 0.8571429 7.2
#> 56 -5.645252e-01 -0.2632180 1.0000000 7.2
#> 57 0.000000e+00 0.0000000 0.0000000 8.1
#> 58 -2.936539e-01 -0.1068813 0.1428571 8.1
#> 59 -5.873079e-01 -0.2137626 0.2857143 8.1
#> 60 -5.873079e-01 -0.2137626 0.4285714 8.1
#> 61 -9.396926e-01 -0.3420201 0.5714286 8.2
#> 62 -7.635003e-01 -0.2778914 0.7142857 8.2
#> 63 -5.873079e-01 -0.2137626 0.8571429 8.2
#> 64 -5.873079e-01 -0.2137626 1.0000000 8.2
#> 65 0.000000e+00 0.0000000 0.0000000 9.1
#> 66 -2.938923e-01 -0.1069680 0.1428571 9.1
#> 67 -5.877845e-01 -0.2139361 0.2857143 9.1
#> 68 -6.016447e-01 -0.1612331 0.4285714 9.1
#> 69 -9.848078e-01 -0.1736482 0.5714286 9.2
#> 70 -8.001563e-01 -0.1410891 0.7142857 9.2
#> 71 -6.155048e-01 -0.1085301 0.8571429 9.2
#> 72 -6.016447e-01 -0.1612331 1.0000000 9.2
# use ggforce::geom_bezier for plotting