The connection to read from. This should be a .txt file, with one edge in a line, the two vertices separated by a delimiter.
vertex.names
The names of all vertices in the graph.
mode
Whether the graph to read is directed.
Details
The function edgelist2adj accepts a list of edges and constructs the 0-1 adjacency matrix corresponding to the graph. If file contains an incomplete list of edges, the function determines the actual size of the graph through the vector vertex.names.
Although named as edgelist2adj, the user can also construct a 0-1 matrix corresponding to non-edges, i.e. connections that do not exist between any two vertices.
When file contains incomplete information, the returned 0-1 adjacency matrix (for edges or non-edges) can be used as input in covsel to estimate the complete (and weighted) adjacency matrix.
Value
A 0-1 adjacency matrix of dimension p \times p corresponding to the edges defined in file, where p is the length of the vector vertex.names.
Author(s)
Ali Shojaie and Jing Ma
References
Ma, J., Shojaie, A. & Michailidis, G. (2014). Network-based pathway enrichment analysis with incomplete network information, submitted. http://arxiv.org/abs/1411.7919.
See Also
netEst.dir,netEst.undir
Examples
#Read the data
data(edgelist)
data(nonedgelist)
#Generate the .txt files
write.table(edgelist, file="edgelist.txt", row.names=FALSE)
write.table(nonedgelist, file="nonedgelist.txt", row.names=FALSE)
#Read the edge/nonedge list from files
oneMat = edgelist2adj(file="edgelist.txt", vertex.names=paste0("gene", 1:100),
mode="undirected")
zeroMat = edgelist2adj(file="nonedgelist.txt", vertex.names=paste0("gene", 1:100),
mode="undirected")