Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

links.as.edgelist

Convert a set of links keyed on source to a single list of edges.


Description

This function takes as input a collection of links (as used/described by the model fitting functions in this package) and reproduces the links as a matrix.

Usage

links.as.edgelist(links)

Arguments

links

A list of links; the format of this is described in rtm.collapsed.gibbs.sampler.

Value

A two-column matrix where each row represents an edge. Note that the indices in this matrix are 1-indexed rather than 0-indexed.

Author(s)

Jonathan Chang (slycoder@gmail.com)

See Also

rtm.collapsed.gibbs.sampler for the input format. predictive.link.probability is a usage example of the output of this function.

Examples

## Take the citations for the first few documents of Cora.
data(cora.cites)

links <- cora.cites[1:5]
links
## [[1]]
## [1] 484 389

## [[2]]
## integer(0)

## [[3]]
## integer(0)

## [[4]]
## [1] 177 416 533

## [[5]]
## [1] 153

links.as.edgelist(links)
##      [,1] [,2]
## [1,]    1  485
## [2,]    1  390
## [3,]    4  178
## [4,]    4  417
## [5,]    4  534
## [6,]    5  154

lda

Collapsed Gibbs Sampling Methods for Topic Models

v1.4.2
LGPL
Authors
Jonathan Chang
Initial release
2015-11-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.