Calculate the RSS from one node to another.

Description

For a single pair of nodes, implement the RSS algorithm of Chen et al. (2012).

Usage

1
2
3
  RelationStrengthSimilarity(xadj, v1, v2, radius = 3,
    directed = TRUE,
    method = c("Rcpp", "BetterR", "NaiveR"))

Arguments

xadj

numeric matrix, then description of arg1.

v1

numeric Object type, then description of arg2.

v2

numeric Object type, then description of arg2.

radius

numeric, length of longest path examined from v1 to v2.

directed

logical, if TRUE returns a symmetric RSS matrix.

method

character, choose the method of calculation.

Details

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.

Value

numeric, Relation Strength Similarity score(s).

Author(s)

Stephen R. Haptonstahl srh@haptonstahl.org

References

"Discovering Missing Links in Networks Using Similarity Measures", Hung-Hsuan Chen, Liang Gou, Xiaolong (Luke) Zhang, C. Lee Giles. 2012.

https://github.com/shaptonstahl/

See Also

ScalablePCA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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