RelationStrengthSimilarity {dils} | R Documentation |
For a single pair of nodes, implement the RSS algorithm of Chen et al. (2012).
RelationStrengthSimilarity(xadj, v1, v2, radius = 3, directed = TRUE, method = c("Rcpp", "BetterR", "NaiveR"))
xadj |
numeric matrix, then description of
|
v1 |
numeric Object type, then description of
|
v2 |
numeric Object type, then description of
|
radius |
numeric, length of longest path examined
from |
directed |
logical, if TRUE returns a symmetric RSS matrix. |
method |
character, choose the method of calculation. |
If v1
and v2
are specified, this returns
the RSS from v1
to v2
. If not, it
calculates the RSS scores for all dyads in the network.
numeric, Relation Strength Similarity score(s).
Stephen R. Haptonstahl srh@haptonstahl.org
"Discovering Missing Links in Networks Using Similarity Measures", Hung-Hsuan Chen, Liang Gou, Xiaolong (Luke) Zhang, C. Lee Giles. 2012.
https://github.com/shaptonstahl/
g1 <- graph.atlas(128) ## Not run: plot(g1) M1 <- as.matrix(get.adjacency(g1)) M1 RelationStrengthSimilarity(xadj=M1, v1=5, v2=6, radius=1) RelationStrengthSimilarity(xadj=M1, v1=5, v2=6, radius=2) RelationStrengthSimilarity(xadj=M1, v1=5, v2=6, radius=3) RelationStrengthSimilarity(xadj=M1, v1=5, v2=6, radius=4) RelationStrengthSimilarity(xadj=M1, radius=2) TestUndirectedNetwork <- function(n) { M <- matrix(runif(n*n), nrow=n) M <- (M + t(M)) / 2 diag(M) <- 0 return(M) } M2 <- TestUndirectedNetwork(75) system.time(RelationStrengthSimilarity(xadj=M2, directed=FALSE, method="BetterR")) # all R system.time(RelationStrengthSimilarity(xadj=M2, directed=FALSE)) # Rcpp