makeSymmetric: Convert a network in source-target-weight format to symmetric...

Description Usage Arguments Details Value Examples

View source: R/makeSymmetric.R

Description

Convert a network in source-target-weight format to symmetric matrix

Usage

1
makeSymmetric(x, verbose = FALSE)

Arguments

x

(data.frame) three columns, with source node, target node, and edge weight. Entries must include universe of nodes; those with missing edges must be included as having edge weight NA

verbose

(logical) print messages

Details

A common format for network representation is to use a three column table listing source node, target node, and weight. This is the format netDx uses for network integration and visualization in Cytoscape. However, some functionality requires a square symmetric adjacency matrix. This function takes as input the three-column format and converts to the adjacency matrix. NOTE: Symmetric attribute is assumed, and the function automatically sets a[i,j] = a[j,i]. Diagonal is assumed to have value of 1.0. Finally missing edges will be assigned NA values.

Value

(matrix) symmetric adjacency matrix

Examples

1
2
3
src <- c("A","B"); tgt <- c("C","C")
cur <- data.frame(source=src,target=tgt,weight=c(0.3,0.8))
makeSymmetric(cur)

BaderLab/netDx documentation built on Sept. 26, 2021, 9:13 a.m.