\(A_{ij} = 1\) iff \((i, j) \in E\), symmetrised for undirected
graphs. Labels may be arbitrary; they map to indices in sorted
order and the mapping is returned.
Usage
morie_adjacency_matrix(edges, n = NULL, directed = FALSE)
Arguments
- edges
Two-column matrix or list of pairs.
- n
Optional number of nodes (integer labels then index
directly).
- directed
Keep edges one-way.
Value
Named list with A, nodes, degree,
n, m, directed, method.
Details
Mirrors morie.fn.sgtadj.
References
Chung, F. R. K. (1997). Spectral Graph Theory.
CBMS 92, AMS. Ch. 1.
Examples
morie_adjacency_matrix(rbind(c("A", "B"), c("B", "C")))$degree
#> [1] 1 2 1