In order for the `Knet`

or `Knode`

functions to be run on a network, it is necessary to place the raw distances between each vertex pair into discreet distance bins, as the functions are unable to handle continuous distributions of distances. This is done automatically within the `Knet`

and `Knode`

functions, but can also be done separately using `BinGraph`

.

1 |

`D` |
Numeric matrix, a distance matrix output by |

`nsteps` |
Integer value, the desired number of bins across which the distances are to be split. If there are too few unique distances to fill each bin, then fewer bins are returned. |

`equal.bin.fill` |
Logical, if |

`verbose` |
Logical, if |

In order for the `Knet`

or `Knode`

functions to be run, the vertex pair distances (as computed by `DistGraph`

) but be split into bins. This is done as part of the `Knet`

or `Knode`

. However, this step is often slow for large networks and therefore the `BinGraph`

function is provided separately, in order to avoid repeat computation.

Each vertex pair is placed into a bin, either ranging from 1 to `nsteps`

, or from 1 to the number of unique distances.

If `equal.bin.fill`

is `FALSE`

, then the bin each vertex pair is placed into is directly proportional to the largest vertex pair distance. For example, if the distance between the pair is 25% of the largest distance and `nsteps`

equals `100`

, then the vertex pair will be placed into bin `25`

. However, this can create problems when there are a small number of edges with especially large distances, as this can result in the majority of vertex pairs being placed into a small number of bins. This can reduce the effectiveness of the `Knet`

and `Knode`

functions. Therefore, when `equal.bin.fill`

is `TRUE`

, the function attempts to fill each bin with an equal number of vertex pairs. If there are a large number of tied distances, then the bins may not be filled equally.

Integer matrix with the same dimensions as `D`

.

Alex J. Cornish a.cornish12@imperial.ac.uk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# create network and calculate the distance matrix using the shortest paths measure
g1 <- barabasi.game(6, directed=FALSE)
plot(g1, layout=layout.fruchterman.reingold)
D1 <- DistGraph(g1, dist.method="shortest.paths")
# place the distances into distance bins
BinGraph(D1, nsteps=100)
# create network and calculate the distance matrix using diffusion kernel-based measure
g2 <- erdos.renyi.game(6, p.or.m=0.5, directed=FALSE)
g2 <- set.edge.attribute(g2, name="distance", value=runif(ecount(g2)))
plot(g2, layout=layout.fruchterman.reingold)
# place the distances into distance bins
D2 <- DistGraph(g2, dist.method="diffusion", edge.attr="distance")
BinGraph(D2, nsteps=100)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.