Skip to contents

Implements the classic edge bundling by Holten.

Usage

edge_bundle_force(
  object,
  xy,
  K = 1,
  C = 6,
  P = 1,
  S = 0.04,
  P_rate = 2,
  I = 50,
  I_rate = 2/3,
  compatibility_threshold = 0.6,
  eps = 1e-08
)

Arguments

object

a graph object (igraph/network/tbl_graph)

xy

coordinates of vertices

K

spring constant

C

number of iteration cycles

P

number of initial edge divisions

S

initial step size

P_rate

rate of edge divisions

I

number of initial iterations

I_rate

rate of iteration decrease per cycle

compatibility_threshold

threshold for when edges are considered compatible

eps

accuracy

Value

data.frame containing the bundled edges

Details

This is a re-implementation of https://github.com/upphiminn/d3.ForceBundle. Force directed edge bundling is slow (O(E^2)).

see online for plotting tips

References

Holten, Danny, and Jarke J. Van Wijk. "Force-Directed Edge Bundling for Graph Visualization." Computer Graphics Forum (Blackwell Publishing Ltd) 28, no. 3 (2009): 983-990.

Author

David Schoch

Examples

library(igraph)
#> 
#> Attaching package: ‘igraph’
#> The following objects are masked from ‘package:stats’:
#> 
#>     decompose, spectrum
#> The following object is masked from ‘package:base’:
#> 
#>     union
g <- graph_from_edgelist(
    matrix(c(
        1, 12, 2, 11, 3, 10,
        4, 9, 5, 8, 6, 7
    ), ncol = 2, byrow = TRUE), FALSE
)
xy <- cbind(c(rep(0, 6), rep(1, 6)), c(1:6, 1:6))
edge_bundle_force(g, xy)
#>               x        y      index group
#> 1   0.000000000 1.000000 0.00000000     1
#> 2   0.008647966 1.185137 0.03030303     1
#> 3   0.014879426 1.301964 0.06060606     1
#> 4   0.027136509 1.510348 0.09090909     1
#> 5   0.038181351 1.672843 0.12121212     1
#> 6   0.048136015 1.806628 0.15151515     1
#> 7   0.058286705 1.942714 0.18181818     1
#> 8   0.076570895 2.159926 0.21212121     1
#> 9   0.089507277 2.296006 0.24242424     1
#> 10  0.107794433 2.484172 0.27272727     1
#> 11  0.123932609 2.646244 0.30303030     1
#> 12  0.138893228 2.794076 0.33333333     1
#> 13  0.160706671 2.969781 0.36363636     1
#> 14  0.184114686 3.100309 0.39393939     1
#> 15  0.210712207 3.246366 0.42424242     1
#> 16  0.300016322 3.428936 0.45454545     1
#> 17  0.424797192 3.501619 0.48484848     1
#> 18  0.550181475 3.500919 0.51515152     1
#> 19  0.681988987 3.578892 0.54545455     1
#> 20  0.772008726 3.711603 0.57575758     1
#> 21  0.805646559 3.852816 0.60606061     1
#> 22  0.841016035 4.029786 0.63636364     1
#> 23  0.856873630 4.175313 0.66666667     1
#> 24  0.875719301 4.353678 0.69696970     1
#> 25  0.889282610 4.486283 0.72727273     1
#> 26  0.907750606 4.677837 0.75757576     1
#> 27  0.919511313 4.819154 0.78787879     1
#> 28  0.934304209 5.002496 0.81818182     1
#> 29  0.946512243 5.164910 0.84848485     1
#> 30  0.958332596 5.327352 0.87878788     1
#> 31  0.968731700 5.489332 0.90909091     1
#> 32  0.972317748 5.543579 0.93939394     1
#> 33  0.979247216 5.652067 0.96969697     1
#> 34  1.000000000 6.000000 1.00000000     1
#> 35  0.000000000 2.000000 0.00000000     2
#> 36  0.012483188 2.111069 0.03030303     2
#> 37  0.023071894 2.199039 0.06060606     2
#> 38  0.038486381 2.318076 0.09090909     2
#> 39  0.052530417 2.421444 0.12121212     2
#> 40  0.065954324 2.513160 0.15151515     2
#> 41  0.080995457 2.616051 0.18181818     2
#> 42  0.098862179 2.730940 0.21212121     2
#> 43  0.114156109 2.828123 0.24242424     2
#> 44  0.131954813 2.936929 0.27272727     2
#> 45  0.148830020 3.039865 0.30303030     2
#> 46  0.163030022 3.126668 0.33333333     2
#> 47  0.182632526 3.245728 0.36363636     2
#> 48  0.211371263 3.345556 0.39393939     2
#> 49  0.243392762 3.443319 0.42424242     2
#> 50  0.328403682 3.495960 0.45454545     2
#> 51  0.421779351 3.498344 0.48484848     2
#> 52  0.528429303 3.499147 0.51515152     2
#> 53  0.646198160 3.516107 0.54545455     2
#> 54  0.733635240 3.561518 0.57575758     2
#> 55  0.774820271 3.657489 0.60606061     2
#> 56  0.810968528 3.755175 0.63636364     2
#> 57  0.828159043 3.857603 0.66666667     2
#> 58  0.845568014 3.960892 0.69696970     2
#> 59  0.862314885 4.062295 0.72727273     2
#> 60  0.879556688 4.166727 0.75757576     2
#> 61  0.895060868 4.266615 0.78787879     2
#> 62  0.911477347 4.372896 0.81818182     2
#> 63  0.925693316 4.469107 0.84848485     2
#> 64  0.941956956 4.579289 0.87878788     2
#> 65  0.956948050 4.681183 0.90909091     2
#> 66  0.971409379 4.785817 0.93939394     2
#> 67  0.979255815 4.842598 0.96969697     2
#> 68  1.000000000 5.000000 1.00000000     2
#> 69  0.000000000 3.000000 0.00000000     3
#> 70  0.030303030 3.030303 0.03030303     3
#> 71  0.060605926 3.060606 0.06060606     3
#> 72  0.090073842 3.090074 0.09090909     3
#> 73  0.121211745 3.121212 0.12121212     3
#> 74  0.150010899 3.150011 0.15151515     3
#> 75  0.181817369 3.181817 0.18181818     3
#> 76  0.208569537 3.208570 0.21212121     3
#> 77  0.242423262 3.242423 0.24242424     3
#> 78  0.270175650 3.270176 0.27272727     3
#> 79  0.303029046 3.303029 0.30303030     3
#> 80  0.328060386 3.328060 0.33333333     3
#> 81  0.363635159 3.363635 0.36363636     3
#> 82  0.391719320 3.391719 0.39393939     3
#> 83  0.424240824 3.424241 0.42424242     3
#> 84  0.446807587 3.446808 0.45454545     3
#> 85  0.484846744 3.484847 0.48484848     3
#> 86  0.512057899 3.512058 0.51515152     3
#> 87  0.545453022 3.545453 0.54545455     3
#> 88  0.569373135 3.569373 0.57575758     3
#> 89  0.606059551 3.606060 0.60606061     3
#> 90  0.636183634 3.636184 0.63636364     3
#> 91  0.666665543 3.666666 0.66666667     3
#> 92  0.690160799 3.690161 0.69696970     3
#> 93  0.727270978 3.727271 0.72727273     3
#> 94  0.753500919 3.753501 0.75757576     3
#> 95  0.787877587 3.787878 0.78787879     3
#> 96  0.814783445 3.814783 0.81818182     3
#> 97  0.848484302 3.848484 0.84848485     3
#> 98  0.878787691 3.878788 0.87878788     3
#> 99  0.907922642 3.907923 0.90909091     3
#> 100 0.937589848 3.937590 0.93939394     3
#> 101 0.969696680 3.969697 0.96969697     3
#> 102 1.000000000 4.000000 1.00000000     3
#> 103 0.000000000 4.000000 0.00000000     4
#> 104 0.030303030 3.969697 0.03030303     4
#> 105 0.060605926 3.939394 0.06060606     4
#> 106 0.090073842 3.909926 0.09090909     4
#> 107 0.121211745 3.878788 0.12121212     4
#> 108 0.150010899 3.849989 0.15151515     4
#> 109 0.181817369 3.818183 0.18181818     4
#> 110 0.208569537 3.791430 0.21212121     4
#> 111 0.242423262 3.757577 0.24242424     4
#> 112 0.270175650 3.729824 0.27272727     4
#> 113 0.303029046 3.696971 0.30303030     4
#> 114 0.328060386 3.671940 0.33333333     4
#> 115 0.363635159 3.636365 0.36363636     4
#> 116 0.391719320 3.608281 0.39393939     4
#> 117 0.424240824 3.575759 0.42424242     4
#> 118 0.446807587 3.553192 0.45454545     4
#> 119 0.484846744 3.515153 0.48484848     4
#> 120 0.512057899 3.487942 0.51515152     4
#> 121 0.545453022 3.454547 0.54545455     4
#> 122 0.569373135 3.430627 0.57575758     4
#> 123 0.606059551 3.393940 0.60606061     4
#> 124 0.636183634 3.363816 0.63636364     4
#> 125 0.666665543 3.333334 0.66666667     4
#> 126 0.690160799 3.309839 0.69696970     4
#> 127 0.727270978 3.272729 0.72727273     4
#> 128 0.753500919 3.246499 0.75757576     4
#> 129 0.787877587 3.212122 0.78787879     4
#> 130 0.814783445 3.185217 0.81818182     4
#> 131 0.848484302 3.151516 0.84848485     4
#> 132 0.878787691 3.121212 0.87878788     4
#> 133 0.907922642 3.092077 0.90909091     4
#> 134 0.937589848 3.062410 0.93939394     4
#> 135 0.969696680 3.030303 0.96969697     4
#> 136 1.000000000 3.000000 1.00000000     4
#> 137 0.000000000 5.000000 0.00000000     5
#> 138 0.012483188 4.888931 0.03030303     5
#> 139 0.023071894 4.800961 0.06060606     5
#> 140 0.038486381 4.681924 0.09090909     5
#> 141 0.052530417 4.578556 0.12121212     5
#> 142 0.065954324 4.486840 0.15151515     5
#> 143 0.080995457 4.383949 0.18181818     5
#> 144 0.098862179 4.269060 0.21212121     5
#> 145 0.114156109 4.171877 0.24242424     5
#> 146 0.131954813 4.063071 0.27272727     5
#> 147 0.148830020 3.960135 0.30303030     5
#> 148 0.163030022 3.873332 0.33333333     5
#> 149 0.182632526 3.754272 0.36363636     5
#> 150 0.211371263 3.654444 0.39393939     5
#> 151 0.243392762 3.556681 0.42424242     5
#> 152 0.328403682 3.504040 0.45454545     5
#> 153 0.421779351 3.501656 0.48484848     5
#> 154 0.528429303 3.500853 0.51515152     5
#> 155 0.646198160 3.483893 0.54545455     5
#> 156 0.733635240 3.438482 0.57575758     5
#> 157 0.774820271 3.342511 0.60606061     5
#> 158 0.810968528 3.244825 0.63636364     5
#> 159 0.828159043 3.142397 0.66666667     5
#> 160 0.845568014 3.039108 0.69696970     5
#> 161 0.862314885 2.937705 0.72727273     5
#> 162 0.879556688 2.833273 0.75757576     5
#> 163 0.895060868 2.733385 0.78787879     5
#> 164 0.911477347 2.627104 0.81818182     5
#> 165 0.925693316 2.530893 0.84848485     5
#> 166 0.941956956 2.420711 0.87878788     5
#> 167 0.956948050 2.318817 0.90909091     5
#> 168 0.971409379 2.214183 0.93939394     5
#> 169 0.979255815 2.157402 0.96969697     5
#> 170 1.000000000 2.000000 1.00000000     5
#> 171 0.000000000 6.000000 0.00000000     6
#> 172 0.008647966 5.814863 0.03030303     6
#> 173 0.014879426 5.698036 0.06060606     6
#> 174 0.027136509 5.489652 0.09090909     6
#> 175 0.038181351 5.327157 0.12121212     6
#> 176 0.048136015 5.193372 0.15151515     6
#> 177 0.058286705 5.057286 0.18181818     6
#> 178 0.076570895 4.840074 0.21212121     6
#> 179 0.089507277 4.703994 0.24242424     6
#> 180 0.107794433 4.515828 0.27272727     6
#> 181 0.123932609 4.353756 0.30303030     6
#> 182 0.138893228 4.205924 0.33333333     6
#> 183 0.160706671 4.030219 0.36363636     6
#> 184 0.184114686 3.899691 0.39393939     6
#> 185 0.210712207 3.753634 0.42424242     6
#> 186 0.300016322 3.571064 0.45454545     6
#> 187 0.424797192 3.498381 0.48484848     6
#> 188 0.550181475 3.499081 0.51515152     6
#> 189 0.681988987 3.421108 0.54545455     6
#> 190 0.772008726 3.288397 0.57575758     6
#> 191 0.805646559 3.147184 0.60606061     6
#> 192 0.841016035 2.970214 0.63636364     6
#> 193 0.856873630 2.824687 0.66666667     6
#> 194 0.875719301 2.646322 0.69696970     6
#> 195 0.889282610 2.513717 0.72727273     6
#> 196 0.907750606 2.322163 0.75757576     6
#> 197 0.919511313 2.180846 0.78787879     6
#> 198 0.934304209 1.997504 0.81818182     6
#> 199 0.946512243 1.835090 0.84848485     6
#> 200 0.958332596 1.672648 0.87878788     6
#> 201 0.968731700 1.510668 0.90909091     6
#> 202 0.972317748 1.456421 0.93939394     6
#> 203 0.979247216 1.347933 0.96969697     6
#> 204 1.000000000 1.000000 1.00000000     6