Skip to contents

R arm of morie.fn.sgtadj and sgtnbe (sgtsbnd and prnkpg have their own files). Sgtadj: adjacency matrix of an edge list (labels in sorted order, or integer labels as indices when n is given; duplicate edges collapse, undirected edges are symmetrised). Sgtnbe: the Hashimoto non-backtracking matrix on the directed edge set, \(B_{ef} = 1\) when f continues where e ends without walking back.

Usage

Sgtadj(edges, n = NULL, directed = FALSE)

Sgtnbe(edges, n = NULL)

Arguments

edges

List of length-2 vectors, or a two-column matrix, of node labels.

n

Number of nodes (optional).

directed

Keep edges one way.

Value

A list (the Python payload).

References

Hashimoto, K. (1989). Zeta functions of finite graphs and representations of p-adic groups. Advanced Studies in Pure Mathematics 15, 211-280.

Krzakala, F., Moore, C., Mossel, E., Neeman, J., Sly, A., Zdeborova, L. and Zhang, P. (2013). Spectral redemption in clustering sparse networks. PNAS 110, 20935-20940.

Examples

Sgtadj(list(c("A", "B"), c("B", "C")))$A
#>      [,1] [,2] [,3]
#> [1,]    0    1    0
#> [2,]    1    0    1
#> [3,]    0    1    0
Sgtnbe(list(c(0, 1), c(1, 2)))$B
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    0    1    0
#> [2,]    0    0    0    0
#> [3,]    0    0    0    0
#> [4,]    0    1    0    0