adjlist_to_matrix: Convert adjacency list into matrix

Description Usage Arguments Value Examples

View source: R/adjlist_to_matrix.R

Description

An adjacency contains NxN observations that can be alternatively represented as an NxN square matrix. This function performs that conversion.

Usage

1

Arguments

input_df

A tibble with NxN observations, such that every row is a pairwise combination of two nodes ('from' and 'to'), and a column called 'edge' encodes whether there is a relationship between them.

Value

A square NxN matrix, where N=number of nodes.

Examples

1
2
3
4
5
`%>%` <- magrittr::`%>%`
successr::karate %>%
    tidygraph::as_tbl_graph(directed = F) %>%
    graph_to_adjlist() %>%
    adjlist_to_matrix()

psychNerdJae/successr documentation built on Dec. 22, 2021, 9:56 a.m.