Learn R Programming

OCNet (version 1.2.2)

OCN_to_igraph: Transform OCN into igraph object

Description

Function that transforms an OCN into an igraph object.

Usage

OCN_to_igraph(OCN, level)

Value

An igraph object.

Arguments

OCN

A river object as produced by aggregate_OCN.

level

Aggregation level at which the OCN is converted into an igraph object. It must be equal to either "FD", "RN" or "AG".

Examples

Run this code
# 1) transform a 20x20 OCN, at the AG level, into a graph object 
OCN <- aggregate_OCN(landscape_OCN(OCN_20), thrA = 4)
g <- OCN_to_igraph(OCN, level = "AG")
plot(g, layout = matrix(c(OCN$AG$X,OCN$AG$Y), ncol = 2, nrow = OCN$AG$nNodes))

Run the code above in your browser using DataLab