Learn R Programming

shp2graph (version 0-2)

PN.amalgamation: Amalgamate edges connected by a pseudo-node

Description

This function is to amalgamate edges connected by a pseudo-node, i.e. to get rid of pseudo-nodes in a network.

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

Attribute data frame for all the edges, of which the number of rows equals to the number of edges;

ea.prop

a vector (of lenght equal to the number of columns in “eadf”) consisted of 1, 2, 3 or 4, and one value cooresponds to a kind of redefination function, see Redef.functions;

Directed

A logical parameter to specify whether edges are directed or not;

DegreeL

A vector (of length equal to the number of nodes) of degrees for the nodes, and it should be NULL if “Directed” is TRUE;

InDegreeL

A vector (of length equal to the number of nodes) of in-degrees for the nodes;

OutDegreeL

A vector of out-degrees for the nodes;

Nexception

A vector of node IDs considered as exceptions, and all the nodes included won't be processed;

Eexception

A vector of edge IDs considered as exceptions, and all the edges included won't be processed;

Value

Two types of list for “undirected” and “directed” edges respectively: For undirected type:

newNodelist

The new nodelist with pseudo-nodes removed;

newEdgelist

The new edgelist with edges connected by a pseudo-node amalgamated;

newEadf

The new attribute data frame for the returned “edgelist”;

DegreeL

The new degree vector cooresponding to the returned “nodelist”;

For directed type:
newNodelist

The new “nodelist” with pseudo-node removed;

newEdgelist

The new “edgelist” with edges connected by a pseudo-node amalgamated;

newEadf

The new attribute data frame for the returned “edgelist”;

InDegreeL

The new in-degree vector cooresponding to the returned “nodelist”;

OutDegreeL

The new out-degree vector cooresponding to the returned “nodelist”;

See Also

SL.extraction, ME.simplification

Examples

Run this code
# NOT RUN {
data(ORN)
rtNEL<-readshpnw(rn, 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(rn)
points(ptcoords, col="green")
plot(rn)
points(Nodes.coordinates(rtNEL[[2]]), col="red")
# }

Run the code above in your browser using DataLab