adjacency_matrix {rhype} | R Documentation |
Find the Adjacency Matrix of a Hypergraph
Description
An adjacency matrix is a square matrix with both rows and columns being indexed by vertices. For each entry, the number is proportional to the strength of the connection going from the vertex represented as the row and the vertex represented by the column. For undirected hypergraphs, this matrix is symmetric but this is usually not the case for directed.
Usage
adjacency_matrix(hype, normalise = TRUE, self_adj = TRUE, as_matrix = FALSE)
Arguments
hype |
A hypergraph object |
normalise |
Whether the matrix should be normalised to either 1 or 0 |
self_adj |
Whether self adjacency should be represented |
as_matrix |
Whether the output should be coerced into a simple matrix |
Details
Great care should be taken when using a hypergraph with mixed positive and negative real coefficients as there is a chance no adjacency will be registered for two adjacenct vertices. rhype does not check for these cases and they must be checked for by the user.
Value
A matrix of adjacencies between vertices of a hypergraph.
Examples
h1 <- example_hype()
adjacency_matrix(h1)
h2 <- example_hype(oriented = TRUE, directed = TRUE)
adjacency_matrix(h2)