getEdgeList: Converts an adjacency matrix into edge list representation

Description Usage Arguments Author(s) Examples

Description

Given an adjacency matrix, converts it into edge list representation. This edge list can be written to a file for easy import into other software such as cytoscape.

Only the upper triangle is returned as it is assumed the matrix is symmetric. The edge list is returned as a data frame with 3 columns: 'From', 'To' and 'Weight'.

Usage

1
	getEdgeList(m, rm.zero=TRUE)

Arguments

m

- An adjacency matrix.

rm.zero

- A boolean to indicate whether zero weight edges should be excluded from the edge list.

Author(s)

Nathan S. Watson-Haigh

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
	data(PCIT)
	m <- m[1:200,1:200]        # just use a small subset of the data
	
	el <- getEdgeList(m)
	
	# modify the edge list to include some useful attributes for cytoscape
	el$sign[el$Weight<0] <- '-'
	el$sign[el$Weight>0] <- '+'
	el$Weight <- abs(el$Weight)
	# write the edge list stuff to a file suitable for import into cytoscape
	write.table(el, file="el.txt", row.names=FALSE, col.names=TRUE, sep="\t",
		quote=FALSE)


Search within the PCIT package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.