Learn R Programming

rgexf (version 0.16.3)

edge.list: Decompose an edge list

Description

Generates two data frames (nodes and edges) from a list of edges

Usage

edge.list(x)

Value

A list containing two data frames.

Arguments

x

A matrix or data frame structured as a list of edges

Author

George Vega Yon

Jorge Fabrega Lacoa

Details

edge.list transforms the input into a two-elements list containing a dataframe of nodes (with columns “id” and “label”) and a dataframe of edges. The last one is numeric (with columns “source” and “target”) and based on auto-generated nodes' ids.

Examples

Run this code

  edgelist <- matrix(
    c("matthew","john",
      "max","stephen",
      "matthew","stephen"),
    byrow=TRUE, ncol=2)
  
  edge.list(edgelist)

Run the code above in your browser using DataLab