nel2igraph {shp2graph} | R Documentation |
Produce an “igraph” object
Description
A function to produce an “igraph” object with the “nodelist” and “edgelist”, which could be returned by the function readshpnw.
Usage
nel2igraph(nodelist, edgelist, weight = NULL, eadf = NULL, Directed = FALSE)
Arguments
nodelist |
A “nodelist” object |
edgelist |
An “edgelist” object |
weight |
A numberic vector to weight all the edges in the “edgelist”, of which the length equals to the number of edges; |
eadf |
A data frame of attributes corresponding to all the edges; |
Directed |
TRUE if edges are directed, FALSE otherwise; |
Details
1. The weighting vector, “weight”, will be used as default for any weigted calculations with edges in the “igraph” object.
2. The coordinate of each node is attached as attributes “X” and “Y”,
which could be retrived via the function “get.vertex.attribute
” from
the package igraph.
Value
gr |
An “igraph” object |
Author(s)
Binbin Lu binbinlu@whu.edu.cn
Examples
data(ORN)
rtNEL<-readshpnw(ORN.nt, ELComputed=TRUE)
#Add the edge length as the weight for graph
igr<-nel2igraph(rtNEL[[2]],rtNEL[[3]],weight=rtNEL[[4]])
plot(igr, vertex.label=NA, vertex.size=2,vertex.size2=2)
#plot(ORN.nt)
[Package shp2graph version 1-0 Index]