Learn R Programming

shp2graph (version 0-2)

Directed: Orientate each edge in a given edgelist

Description

This function is to orientate each edge according to the given vector.

Usage

Directed(edgelist, direction.v=rep(0,length(edgelist[,1])), eadf=NULL)

Arguments

edgelist

An edgelist object, see “edgelist”

direction.v

A vector (of length equal to number of edges in edgelist) with values of 1 or 0, see details below;

eadf

Attribute data frame for all the edges;

Value

A list consisted of:

newEdgelist

A new “edgelist” with directed edges

newEadf

A new attribute data frame for the new “edgelist”

Details

In a road network data set, some road segments might be one-way while the rest are double-way. This suitation makes it complex for defining edges in the graph. This property could be specified in “direction.v”: 1 means one-way and 0 represents double-way. All the double-way edges in edgelist are clarified as two directed edges (i.e. edge(nid1, nid2) and edge(nid1, nid2) and edge(nid2, nid1)), and duplicate the corresponding attributes. The one-way edges could be regarded as directed.