read_pajek: Read foreign graph formats

View source: R/read_write_foreign.r

read_pajekR Documentation

Read foreign graph formats

Description

Reading pajek and Ucinet files, this function returns weighted edgelists in the form of data frames including a data frame of the vertices. (function on development)

Usage

read_pajek(x)

read_ml(x)

Arguments

x

Character scalar. Path to the file to be imported.

Details

Since .net files allow working with multi-relational networks (more than one class of edge), the function returns lists of edges and edgeslist with the corresponding tag on the .net file. For example, if the .net file contains

 *Arcslist :9 "SAMPPR"
 ...
 *Arcslist :10 "SAMNPR"

The output will include data frames of edgelists with those tags.

Value

In the case of read_pajek, a list with three elements

vertices

A data frame with n rows and two columns: id and label

edges

If not null, a list of data frames with three columns: ego, alter, w (weight)

edgelist

If not null, a list of data frame with three columns: ego, alter, w (weight)

For read_ml, a list with two elements:

adjmat

An array with the graph

meta

A list with metadata

Author(s)

George G. Vega Yon

Source

From the pajek manual http://mrvar.fdv.uni-lj.si/pajek/pajekman.pdf

See Also

Other Foreign: igraph, network, read_ucinet_head()

Examples

# From .net: Sampson monastery data from UCINET dataset ---------------------

# Reading the arcs/edges format
path <- system.file("extdata", "SAMPSON.NET", package = "netdiffuseR")
SAMPSON <- read_pajek(path)

# Reading the arcslist/edgelist format
path <- system.file("extdata", "SAMPSONL.NET", package = "netdiffuseR")
SAMPSONL <- read_pajek(path)

# From DL (UCINET): Sampson monastery data (again) --------------------------
path <- system.file("extdata", "SAMPSON.DAT", package = "netdiffuseR")
SAMPSONL <- read_ml(path)


netdiffuseR documentation built on Aug. 30, 2023, 5:07 p.m.