PN.amalgamation {shp2graph} | R Documentation |
Amalgamate edges connected by a pseudo-node
Description
A function to amalgamate edges connected by a pseudo-node.
Usage
PN.amalgamation(nodelist, edgelist, eadf=NULL, ea.prop=NULL, Directed=F,
DegreeL=NULL, InDegreeL=NULL, OutDegreeL=NULL,Nexception=NULL,
Eexception=NULL)
Arguments
nodelist |
A “nodelist” object; |
edgelist |
An “edgelist” object |
eadf |
A data frame of attributes corresponding to all the edges; |
ea.prop |
A vector (of the length equalling to the number of edge attributes in “eadf”) with values of 1, 2, 3 or 4, and each specific value represent a function to assign the attributes of the edited edges, see also Redef.functions: 1->sum(v) 2->min(v) 3->max(v) 4->mean(v) |
Directed |
TRUE if edges are directed, FALSE otherwise; |
DegreeL |
An integer vector of degrees for each node in the given “nodelist”, and it could be ignored if edges are directed |
InDegreeL |
An integer vector of In-degrees for each node in the given “nodelist”, and it could be ignored if edges are undirected |
OutDegreeL |
An integer vector of Out-degrees for each node in the given “nodelist”, and it could be ignored if edges are undirected |
Nexception |
A vector of node IDs concerned as exceptions, and all the edges with these nodes included won't be processed; |
Eexception |
A vector of edge IDs concerned as exceptions, and all these edges won't be processed; |
Value
Two types of list returned for undirected and directed edges, respectively:
For “undirected” edges:
newNodelist |
New node list with pseudo-nodes removed; |
newEdgelist |
New edge list with pseudo-nodes removed; |
newEadf |
New attribute data frame for the returned edgelist; |
DegreeL |
New degree vector cooresponding to the newly returned node list; |
For “directed” network:
newNodelist |
New node list with pseudo-nodes removed; |
newEdgelist |
New edgelist with pseudo-nodes removed; |
newEadf |
Data frame of attributes for the newly returned edge list; |
InDegreeL |
New In-degree vector cooresponding to the newly returned node list; |
OutDegreeL |
New Out-degree vector cooresponding to the newly returned node list; |
Note
Node in a directed network is recognised a a pseudo-node with in-degree and out-degree equalling to 1; while it could be a pseudo-node with degree equalling to 2 in a undirected network.
Author(s)
Binbin Lu binbinlu@whu.edu.cn
See Also
SL.extraction
, ME.simplification
Examples
data(ORN)
rtNEL<-readshpnw(ORN.nt, ELComputed=TRUE)
res.sl<-SL.extraction(rtNEL[[2]],rtNEL[[3]])
res.me<-ME.simplification(res.sl[[1]],res.sl[[2]],DegreeL=res.sl[[4]])
res.pn<-PN.amalgamation(res.me[[1]],res.me[[2]],DegreeL=res.me[[4]])
ptcoords<-Nodes.coordinates(res.pn[[1]])
#plot(ORN.nt)
#points(ptcoords, col="green")
#plot(ORN.nt)
#points(Nodes.coordinates(rtNEL[[2]]), col="red")