NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 NetLogo Publications
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Farsi / Persian
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Network Import Example

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

The code example provides an illustration of how to import network data from external files. This is useful when you have a specific network, perhaps created in another program or taken from real world data, that you would like to recreate in NetLogo.

Note that the Networks extension can automatically import networks from GraphML and many other formats.

The code example is useful when you have network data in a format not supported by the Networks extension.

It imports data from two different files. The first is the "attributes.txt" file, which contains information about the nodes -- in this case, the node-id, size, and color of each node. The second is the "links.txt" file, which contains information on how the nodes are connected and the strength of their connection.

NETLOGO FEATURES

The link primitives are used to represent and process connections between nodes.

The file primitives are used to read data from external files.

(back to the NetLogo Models Library)