make.sociomatrix.from.edges {ElectroGraph}R Documentation

make.sociomatrix.from.edges

Description

Given an edge list, with or without values, produce the corresponding sociomatrix.

Usage

make.sociomatrix.from.edges(inputmat, symmetric=FALSE, fidelities=NULL)

Arguments

inputmat A matrix with dimension n-by-(2,3,4); see below for details.
symmetric If TRUE, creates a symmetric sociomatrix with undirected edges.
fidelities If set, allows for ties that are perceived to be less than ``friends''. (Use with caution – results have not been peer reviewed!

Details

The first two columns of the matrix are the source and target of each directed edge (undirected if symmetry flag is set to TRUE). If inputmat has 3 columns, the third column represents the value of each tie. If inputmat has 4 columns, the third and fourth column represent the edge weights in each direction, as in (source->target), (target->source).

Value

A sociomatrix, where the number of rows and columns is equal to the count of unique nodes specified; row and column names are equal to the node names given.

Author(s)

Andrew C. Thomas <act@acthomas.ca>

Examples

src <- 1:10
tgt <- 2:11
socio <- make.sociomatrix.from.edges(cbind(src,tgt), symmetric=TRUE)

values <- rgamma(10,3,3)
socio.value <- make.sociomatrix.from.edges(cbind(src,tgt,values), symmetric=TRUE)

back.values <- rgamma(10,3,12)
socio.value <- make.sociomatrix.from.edges(cbind(src,tgt,values,back.values))


[Package ElectroGraph version 0.2.0 Index]