Is there any kind of netlogo code flow diagram?

171 views
Skip to first unread message

Rafaela Lorena

unread,
Sep 1, 2021, 9:59:47 AM9/1/21
to netlogo-users
Hello everyone,

I'm looking for a tool that from the NetLogo code it is possible to obtain a visual flowchart of all the procedures. And I have not found it.
So, I would like to know if you know if there is such a tool? Or really there is no such tool for NetLogo?

Thanks in advance

jarq...@gmail.com

unread,
Sep 1, 2021, 1:05:17 PM9/1/21
to netlogo-users
This is such a good question.
In my urban simulation courses, I ask the students for a flow diagram before they write the first line of code. That way they know where they are if they get lost, or use it as a revision tool if the model is not behaving as expected. For me, it helps me understand what they want to achieve. But as far as I know, there is now NetLogo tool that translates code to diagram, or the other way around. Would be great to hear from other members of this group about this topic.

Michael Tamillow

unread,
Sep 1, 2021, 1:38:35 PM9/1/21
to jarq...@gmail.com, netlogo-users
It would be pretty cool to have a Netlogo program that takes a Netlogo program and creates a flow diagram using level space so that you could step through the program and watch the call graph go back and forth passing around objects and executing code.

Sent from my iPhone

On Sep 1, 2021, at 12:05 PM, jarq...@gmail.com <jarq...@gmail.com> wrote:

This is such a good question.
--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/18016e9d-2740-4780-97e1-8449c1066de4n%40googlegroups.com.

Arthur Hjorth

unread,
Sep 2, 2021, 5:43:52 AM9/2/21
to Michael Tamillow, jarq...@gmail.com, netlogo-users
A long time ago I wrote the reflection extension (https://github.com/NetLogo/Reflection-Extension). It makes it easy to extract lists of all procedures (including their allowed OTPL-contexts). Bryan Head, Uri and I used it to create a GUI for constructing LevelSpace models (https://dl.acm.org/doi/pdf/10.1145/2771839.2771884).

I don't think the reflection extension has been updated for Hexy/NetLogo 6+, but if someone wanted to do that, it could be used for something like this.

It wouldn't be able to create a flowchart though. For that I would guess you would need to parse the code to see when what is called. 

It sounds like a fun project :)



--
Arthur Hjorth
Postdoc
s: arthurhjorth
m: +45 61 19 97 81
s: arthurhjorth

lrizquierdo

unread,
Sep 3, 2021, 4:01:52 AM9/3/21
to netlogo-users
That would be an excellent project indeed! 
I also find code flow diagrams very useful, especially when teaching. We use them intensively in a book I am writing, but currently we make them by hand. I attach a few examples in case they are useful, and/or you have any comments on how they could be improved::


Cheers,
Luis

jarq...@gmail.com

unread,
Sep 5, 2021, 2:17:33 PM9/5/21
to netlogo-users

Hi Luis and thanks for the book.
As a comment for improvement to your diagams, may I suggest using the following, more standard format:

basic-symbols.jpg

 ...this way, anyone reading the diagram can have a better idea of what is going on at any given time.

Nicolas Sprotti

unread,
Sep 5, 2021, 3:16:55 PM9/5/21
to Michael Tamillow, jarq...@gmail.com, netlogo-users
Happy Memorial Day weekend turtles aficionado.
These are super cool questions / answers. 👍😎

What about the other way around. A Netlogo model in a given space/time where turtles can call others netlogo models living in « smaller » space time (they would be calling the same model just smaller space times)?

Just asking, I think I have a business use case for it.

lrizquierdo

unread,
Sep 6, 2021, 3:41:47 AM9/6/21
to netlogo-users
That's great, thank you so much for your comment. I tried to follow more or less that format (UML, right?), but not strictly, as I thought a slight variation served my purposes slightly better.
The main adaptations I made were to include different types of arrows (for "ask other agents", or "ask other agent") and the use of different colors for the procedures to be run by different types of agents. Nonetheless, I'll rethink all this in the light of your comment.
Thanks again!

Luis Javier Oliva Felipe

unread,
May 9, 2023, 2:39:02 PM5/9/23
to netlogo-users
That seems a mix of sequence and flow diagrams. 
Reply all
Reply to author
Forward
0 new messages