[R-sig-Geo] creating network road

jeremy.raw at dot.gov jeremy.raw at dot.gov
Tue Aug 31 15:38:47 CEST 2010


Discussing either igraph or travelr in detail here is probably off-topic.

igraph has its own active discussion list:
(http://lists.nongnu.org/mailman/listinfo/igraph-help).

Travelr has irregular support available at this time; questions have the best chance of being answered if directed to the travelr discussion list:
(http://lists.r-forge.r-project.org/mailman/listinfo/travelr-discussion).

Questions related to these packages would be better directed to one of those two resource lists.  Both packages contain some references to books and articles describing the structures and operations, and igraph has a gradually developing help page.

That said, here's a basic review of how to start constructing a graph or network for analysis in these packages:

To use spatial data as a network in either of these packages, the data must be disassembled into suitable structures that can be used to construct the internal representations used in each package (the representations are different but closely related).

For analysis by either igraph or travelr, a road network is conceptually simply a graph, and often a directed graph.  To use either of these packages, it is easiest to start with a tabular representation of the network as vertices (in the language of graphs) or nodes (in the language of highway modeling), plus edges (igraph) or links (travelr).

The vertices (nodes) are stored as a vector of numbers from 0 to N-1 (igraph) or 1 to N (travelr).  The travelr package further identifies the first Z nodes (Z <= N) as "zones", which are the sources and sinks of flows assigned over the network.

The roads themselves are modeled as edges (links):  at a minimum, this is a matrix or data frame with one row per edge and two columns indicating which vertices are connected by each edge.  travelr wants the links (edges) to be directed, so there should be a link (edge) for each direction of travel (thus, a link from A to B, and another link from B to A, unless the facility is "one way").  In addition, for routing applications, both packages will work with a vector of edge weights (igraph) or costs (travelr) which are used to construct shortest paths across the network between nodes of interest.  In igraph, the weights are stored as a graph attribute, in travelr, the weights are kept as a vector within an assignment set structure (a classed list; see the travelr documentation -- this is more complex to set up, but greatly facilitates coding the applications to which travelr was designed to be applied).

>From those basic elements, one constructs a graph (highway network) and both packages have instructions for doing this.  Then there are various functions for building shortest paths with weights and (in the case of travelr) performing additional operations on the links associated with the shortest paths.

Igraph is well-developed theoretically and is (once one gets over certain quirks, such as zero-based vertex numbering) very usable.  Travelr is a work in progress and is probably best ignored unless one is ready to read the code in detail (the lower-level functions have been much more extensively tested than the higher-level ones).  Travelr requires more work to set up and process networks, but can be used directly for certain types of analyses that would require considerably more coding in igraph.

I hope that helps.

Jeremy Raw, P.E., AICP
FHWA Office of Planning
jeremy.raw at dot.gov
(202) 366-0986


-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Ricardo Rodríguez
Sent: Monday, August 30, 2010 5:42 PM
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] creating network road

hello, how to create a network of roads, I am looking igraph and Travelr packages but I'm not sure how to enter the network and how to create these packages or other of R, since only the documented functions of the same but File no treatment, someone I could respect or arientar ahy books treat the topic.

thanks for the help and time

Ricardo Rodríguez
Univalle

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list