NetLogo User Manual
Home
Learn NetLogo
What is NetLogo? Tutorial #0 Sample Model Tutorial #1 Models Tutorial #2 Commands Tutorial #3 Procedures
Documentation
NetLogo Dictionary Interface Guide Interface Tab Guide Info Tab Guide Code Tab Guide Programming Guide Transition Guide Preferences Guide Version History
Advanced Tools
Extension Manager Shapes Editor BehaviorSpace System Dynamics HubNet HubNet Authoring Logging Controlling Mathematica Link NetLogo 3D NetLogoLab Cluster Computing (HPC)
Extensions
Extensions Guide Arduino Array Bitmap CSV GIS GoGo LevelSpace Matrix Networks Palette Profiler Python Resource Rnd Sound Simple R Table Time Vid View2.5D
FAQ
Home
Learn NetLogo
What is NetLogo? Tutorial #0 Sample Model Tutorial #1 Models Tutorial #2 Commands Tutorial #3 Procedures
Documentation
NetLogo Dictionary Interface Guide Interface Tab Guide Info Tab Guide Code Tab Guide Programming Guide Transition Guide Preferences Guide Version History
Advanced Tools
Extension Manager Shapes Editor BehaviorSpace System Dynamics HubNet HubNet Authoring Logging Controlling Mathematica Link NetLogo 3D NetLogoLab Cluster Computing (HPC)
Extensions
Extensions Guide Arduino Array Bitmap CSV GIS GoGo LevelSpace Matrix Networks Palette Profiler Python Resource Rnd Sound Simple R Table Time Vid View2.5D
FAQ
primitive: nw:save-to-string
Networks Extension Dictionary
  • No items found

nw:save-to-string

nw:save-to-string format

Serialize the current network context to a string in the given format and report it, rather than writing to a file. This is the counterpart to nw:load-from-string, and is useful in NetLogo Web and other contexts where the result needs to go somewhere other than the file system.

The format argument names the format explicitly and takes the same values as nw:load-from-string. It is case-insensitive and an optional leading dot is ignored, so "gml", "GML", and ".gml" are all equivalent. The supported formats are:

  • dl
  • gdf
  • gexf
  • gml
  • graphml
  • matrix
  • vna

Aside from reporting a string instead of writing to a file, nw:save-to-string behaves exactly like the corresponding nw:save-* primitive, with the same limitations regarding attributes and multigraphs.

For example, to save a network and hand it off to a browser download in NetLogo Web:

let gml nw:save-to-string "gml"
send-to:file "my-network.gml" gml

Take me to the full Networks Extension Dictionary.

Networks Extension Dictionary: save-matrix

Documentation for the save-matrix primitive.

Networks Extension Dictionary: set-context

Documentation for the set-context primitive.

Brand Logo

NetLogo is a programmable modeling environment for simulating natural and social phenomena. It was authored by Uri Wilensky in 1999 and has been in continuous development ever since at the Center for Connected Learning and Computer-Based Modeling.

Related Links
  • NetLogo Home
  • CCL Home
  • NetLogo Web
  • NetTango Web
  • NetLogo 3D
  • BehaviorSearch
  • Contact Us

Copyright © 1999-2026 Uri Wilensky and the Center for Connected Learning and Computer-Based Modeling at Northwestern University . All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License , or (at your option) any later version.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at [email protected] .

For more information, visit the NetLogo website .