procedure_nw: Create NetLogo procedure network

Description Usage Arguments Details Value Examples

View source: R/procedure_nw.R

Description

Create NetLogo procedure network

Usage

1
procedure_nw(modelfiles)

Arguments

modelfiles

vector of filepaths to model files

Details

procedure_nw reads model code from the provided model files. The procedure identifies NetLogo proecdures and searches for procedure calls within the code. From this data, an igraph network is created and returned. This network can be used to plot the model procedure network and identify model components.

Value

network of model procedures (igraph)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 

# Determine the function network:
nw <- procedure_nw(modelfiles)

# Determine communities within the network and plot using Igraph package:
library(igraph)
com <- walktrap.community(nw)
V(nw)$community <- com$membership
rain <- rainbow(14, alpha=.5)
V(nw)$color <- rain[V(nw)$community]

plot(nw,
     edge.arrow.size=.2,
     vertex.label.color="black",
     vertex.label.dist=1,
     vertex.size=5,
     edge.curved=0,
     vertex.label.cex=.5,
     layout=layout_with_fr(nw, niter = 2000))

# Interactive plot using igraph::tkplot
tkplot(nw, layout=layout_with_fr(nw, niter = 2000))

## End(Not run)

nldoc/nldoc documentation built on May 13, 2019, 9:52 p.m.