Spread hits across a network in one or more clusters using an exponential probability distribution related to the distance of each vertex from a seed vertex.
1 2 3 
g 

h 
Integer value, the number of hits in each cluster. 
clusters 
Integer value, the number of clusters to add the network. 
distance.cutoff 
Integer value, the minimum distance between the seed vertex of each cluster. 
lambda 
Numeric value, the strength of hit clustering. If 
dist.method 
String, the method used to compute the distance between each vertex and the seed vertex. 
edge.attr 
String, the name of the edge attribute to be used as distances along the edges. If 
hit.color 
String, the colour of the hits if the network is plotted. 
D 
Precomputed numeric distance matrix. If 
attempts 
Integer value, the number of attempts made at each stage of the placement algorithm before the function terminates. 
verbose 
Logical, if 
SpreadHits
can be used to add hits to a network without hits, or replace hits on a network with hits. The probability of a vertex being labelled as a hit depends on its distance from a randomly chosen starting vertex. The value of lambda
denotes the shape of the probability distribution used to spread the hits. The greater the value of lambda
, the greater the strength of hit clustering. The probability of vertex i being a hit is proportional to
P[i] \sim lambda^{d[start,i]}
where d[start,i] is the distance between the start vertex and vertex i.
Hits can be added in one or more clusters. If multiple clusters are being added, then the function first identifies an equal number of seed vertices at least distance.cutoff
distance apart in the network. If the function cannot identify vertices that satisfy this condition within the specified number of attempts, then it returns NULL
. If the function is able to find suitable seed vertices, then it proceeds to label vertices positioned around each seed vertex as hits, using a probability function shaped by lambda
.
Whether a vertex is a hit or a miss is given in the vertex attribute hits
. If the vertex is a hit, then it has the score 1. If it is a miss, then it has the score 0. A color can also be chosen to highlight the hits when the network is plotted. Misses are automatically coloured grey.
A modified version of the input igraph
object. Whether a vertex is a hit or miss is given under the vertex attribute hits
.
Alex J. Cornish a.cornish12@imperial.ac.uk
1 2 3 4 5 6 7 8 9  # create a network and add 1 cluster of 3 hits
g1 < erdos.renyi.game(30, p.or.m=0.1, directed=FALSE)
g1 < SpreadHits(g1, h=3, clusters=1, lambda=10)
plot(g1, layout=layout.fruchterman.reingold)
# create a network and add 2 clusters of 3 hits
g2 < erdos.renyi.game(30, p.or.m=0.1, directed=FALSE)
g2 < SpreadHits(g2, h=3, clusters=3, distance.cutoff=2, lambda=0)
plot(g2, layout=layout.fruchterman.reingold)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.