Description Usage Arguments Value Examples
View source: R/matrix_to_adjlist.R
An NxN square matrix can be alternatively represented as an adjacency list containing NxN observations. This function performs that conversion.
1 | matrix_to_adjlist(input_matrix, edge_col_name = "edge")
|
input_matrix |
A square NxN matrix, where N=number of nodes. |
edge_col_name |
The name of the column encoding the relation between two given nodes. This is probably 'edge' for adjacency matrices, or 'successor_value' for matrices encoding successor relations. |
A tibble with NxN observations, such that every row is a pairwise combination of two nodes ('from' and 'to'), and a column encoding the relationship between them.
1 2 3 4 5 6 | `%>%` <- magrittr::`%>%`
successr::karate %>%
tidygraph::as_tbl_graph(directed = F) %>%
graph_to_adjlist() %>%
adjlist_to_matrix() %>%
matrix_to_adjlist()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.