makeSymmetric {netDx} | R Documentation

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

### Description

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

### Usage

    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

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

[Package netDx version 1.1.4 Index]