AppVeyor Build Status

The goal of scgraph is to convert anything expressible in silicate form to igraph, and anything in igraph form to silicate form.

In silicate general form the data can be offloaded or transmitted via any standard table-based data system.

Installation

You can install scgraph from github with:

Example

This is a basic example which shows you how to create graphs, from non-graph data that has connectivity understood by the ‘sc’ framework.

First generate some line data.

library(silicate)
library(raster)
r <- aggregate(raster(volcano), fact = 10)
line <- sf::st_as_sf(rasterToContour(r, levels = c(130, 165)))
plot(line)

Convert to graph, the first is a bit of a mess since we are plotting it in “space”-space. The second does more work to show the topology more clearly with two disconnected lines and the single ring.

(That’s the idea.)

library(scgraph)
plot(as.igraph(line), vertex.size = 5)

plot(as.igraph(line, layout = FALSE), vertex.size = 5)

Another example. Here the “hole” in the spatial polygon is seen as a disconnected island, and the two polygons that share an edge running in two different path directions are together.

plot(gtopo, vertex.size = 9, main = "layout as topology", vertex.label.dist= .7, vertex.label.cex = 1)

Example with DiagrammeR.

The geom edge link is essentially the same as the map data.