NLGetGraph: Captures a network.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/NLGetGraph.R

Description

NLGetGraph converts a set of NetLogo Link agents into an igraph graph object (see package igraph for details on graph objects).

Usage

1
NLGetGraph(link.agentset="links", nl.obj=NULL)

Arguments

link.agentset

(optional) A string defining an agentset of NetLogo Links. Default is "links", which are all links.

nl.obj

(optional) A string identifying a reference to a NetLogo instance created with NLStart.

Details

Saves a link network in a graph object of package igraph for network analysis.

Value

Returns a graph object of package igraph.

Author(s)

Jan C. Thiele <rnetlogo@gmx.de>

See Also

NLGetAgentSet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
nl.path <- "C:/Program Files/NetLogo 6.0/app"
NLStart(nl.path)
model.path <- 
"/models/Sample Models/Networks/Preferential Attachment.nlogo"
NLLoadModel(paste(nl.path,model.path,sep=""))
NLCommand("setup")
NLDoCommand(4, "go")
graph1 <- NLGetGraph()
plot(graph1, layout=layout.kamada.kawai, vertex.label=V(graph1)$name,
     vertex.shape="rectangle", vertex.size=20, asp=FALSE)

## End(Not run)

RNetLogo documentation built on May 2, 2019, 5:54 p.m.