Paths Extension

No preview image

This model is seeking new collaborators — would you please help?

2 collaborators

Default-person Miguel Torez (Author)
Default-person Stephanie Yang (Editor)


(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 553 times • Downloaded 24 times • Run 0 times
Download the 'Paths Extension' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This is a model about how paths emerge along commonly traveled routes. People tend to take routes that other travelers before them have taken, making them more popular and causing other travelers to follow those same routes. This can be used to determine an ideal set of routes between a set of points of interest without needing a central planner. Paths emerge from routes that travelers share.


Each of the turtles in the model starts somewhere in the world, and is trying to get to another random location. Turtles prefer to move along the gray patches, representing established paths, if those patches are on the way to their destination. But as each turtle moves, it makes the path that it takes more popular. Once a certain route becomes popular enough, it becomes an established route (shown in gray), which attracts yet more turtles en route to their destination.

On setup, each turtle chooses a destination at random. On each tick, a turtle looks to see if there is a gray patch on the way to its destination, and walks toward it if there is. If there no gray patch, it walks directly towards its destination instead. With each step, a turtle makes each patch it walks on more popular. If a turtle causes the patch to pass a certain popularity threshold, it turns gray to indicate the presence of an established route. On the other hand, if no turtle has stepped on a patch in quite a while, its popularity will decrease over time and it will eventually become green again.

You can interact with this model by placing points of inkkkkkterest for the turtles to travel between. While "go" runs, click on a patch in the model to turn that into a point of interest. Once you have placed two or more such points, turtles will travel only between those locations. To remove a location, click it a second time.


  • popularity-decay-rate controls the rate at which grass loses popularity in the absence of a turtle visiting it.
  • popularity-per-step controls the amount of popularity a turtle contributes to a patch of grass by visiting it.
  • minimum-route-popularity controls how popular a given patch must become to turn into an established route.
  • walker-count controls the number of turtles in the world.
  • walker-vision-dist controls how far from itself each turtle will look to find a patch with an established route to move it closer to its goal.
  • show-popularity? allows you to color more popular patches in a lighter shade of green, reflecting the fact that lots of people have walked on them, and showing the paths as they form.


Try increasing and decreasing walker-vision-dist? When you set it to smaller and larger values, how does the evolution of the model change?

popularity-decay-rate and popularity-per-step balance one another. What happens when the popularity-decay-rate is too high relative to popularity-per-step? What happens when it is too low?

Can you find a way to measure whether the route network is "finished"? Does that change between runs or does it stay relatively constant? How does changing the walker-count affect that?

How does changing the world-wrap effect the shape of the paths that the turtles make?


See what happens if you set up specific destinations for the turtles instead of having them move at random. You might have start off by moving to a particular patch, or have each turtle move in a unique loop.

Come up with a way of plotting how much of each journey a turtle spends on an established route. Try plotting that value against the distance a turtle goes out of its way on a given journey to stay on an established route. How do the two quantities relate to one another?

Modify turtles to sometimes remove established routes instead of just creating them. Which route patches are best to remove? Do the resulting shapes generated by the model change?

Turtles select a new patch to move toward each turn. This isn't a particularly efficient way for a turtle to move and sometimes leads to some awkward routes. Can you come up with a more realistic path-finding scheme?


We looked at three different models before deciding on the paths model. The first model was on AIDS. However, we didn't pick the model in regards to AIDS because we felt that we couldn't properly do it justice by changing the model.

The second model was classified as art, and it involved turtles moving and making different unique sounds depending on their movement. But we didn't pick the music machine model because it seemed too good of a model to alter, so we picked the paths model out of the three because we believe it has unlimited potential in regards to what could be changed, added or omitted.

The paths model depicts different turtles traveling along popular paths. We added a house to test the waters, and we noticed that the turtles wouldn't move towards the one house, so we added more houses and noticed that the turtles responded well to the additonal houses moving in various direction leading to the houses creating more popular locations.

As mentioned earlier, if there were only one house placed on the field regardless of the size and color no change would occur. Also, some houses appeared to get more traction than others as the simulation continued.


  • CCL Cities has some information on city simulation, including other models where "positive feedback" figures prominently.


Inspired by Let pedestrians define the walkways.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2015 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

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

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [ buildings building ]
buildings-own [ bcolor ] ; ADDED

breed [ walkers walker ]
walkers-own [ goal ]

patches-own [ popularity ]

globals [ mouse-clicked? ]

to setup
  set-default-shape buildings "house"
  ask patches [ set pcolor green ]
  create-walkers walker-count [
    setxy random-xcor random-ycor
    set goal one-of patches
    set color yellow
    set size 2

;; Click to place buildings
;; Have stuff unbecome path once it decays below a certain popularity threshold

to go

to check-building-placement
  ifelse mouse-down? [
    if not mouse-clicked? [
      set mouse-clicked? true
      ask patch mouse-xcor mouse-ycor [ toggle-building ]
  ] [
    set mouse-clicked? false

to toggle-building
  let nearby-buildings buildings in-radius 4
  ifelse any? nearby-buildings [
    ; if there is a building near where the mouse was clicked
    ; (and there should always only be one), we remove it and
    ;ask nearby-buildings [ die ]

    ; if there is a building near where the mouse was clicked
    ; check its color
    ; if it is X color (where X is the biggest);
    ; destroy it
    ; else
    ; increase its color value by Y
  let color-increment 8
    ask nearby-buildings with [bcolor = red + ((number-city-sizes - 1) * color-increment) ] [ die ]

    ask nearby-buildings [
      set color bcolor + color-increment
      set bcolor bcolor + color-increment
      set size size + 2 ]
  ] [
    ; if there was no buildings near where
    ; the mouse was clicked, we create one
    sprout-buildings 1 [
      set color red
      set bcolor red
      set size 4

to decay-popularity
  ask patches with [ not any? walkers-here ] [
    set popularity popularity * (100 - popularity-decay-rate) / 100
    ; when popularity is below 1, the patch becomes (or stays) grass
    if popularity < 1 [ set pcolor green ]

to become-more-popular
  set popularity popularity + popularity-per-step
  ; if the increase in popularity takes us above the threshold, become a route
  if popularity >= minimum-route-popularity [ set pcolor gray ]

to move-walkers
  ask walkers [
    ifelse patch-here = goal [
      ifelse count buildings >= 2 [
        set goal [ patch-here ] of most-desirable-building
      ] [
        set goal one-of patches
    ] [

to walk-towards-goal
  if pcolor != gray [
    ; boost the popularity of the patch we're on
    ask patch-here [ become-more-popular ]
  face best-way-to goal
  fd 1

;to-report weighted-distance-from [ location ]
;  [distance myself]

to-report distance-value [ raw-distance ]
  ifelse raw-distance > 0.5 [
      report raw-distance
  ] [
     report 1000000

to-report building-capacity [ building-size ]
  report building-size / 2 * 25

to-report building-population [ building-size ]
  ; count the number of walkers within a certain radius
  report count walkers in-radius (building-size)

to-report most-desirable-building
  ; spread of buildings depends on whether you're looking at the entire map or what's within range
  ifelse global-vision? [
    let available-buildings count buildings with [ building-population size < building-capacity size ]
    let visible-buildings buildings in-radius walker-vision-dist
    let available-buildings count visible-buildings with [ building-population size < building-capacity size ]
  ; calculate desirability via higher color (size) and distance traveled (want less)
  ; add a bit of randomness to simulate real-life variation
  report max-one-of buildings [ (pcolor / (distance-value distance myself)) + (random-normal 0 2) ]

to-report best-way-to [ destination ]

  ; of all the visible route patches, select the ones
  ; that would take me closer to my destination
  let visible-patches patches in-radius walker-vision-dist
  let visible-routes visible-patches with [ pcolor = gray ]
  let routes-that-take-me-closer visible-routes with [
    distance destination < [ distance destination - 1 ] of myself

  ifelse any? routes-that-take-me-closer [
    ; from those route patches, choose the one that is the closest to me
    report min-one-of routes-that-take-me-closer [ distance self ]
  ] [
    ; if there are no nearby routes to my destination
    report destination

to recolor-patches
  ifelse show-popularity? [
    let range (minimum-route-popularity * 3)
    ask patches with [ pcolor != gray ] [
      set pcolor scale-color green popularity (- range) range
  ] [
    ask patches with [ pcolor != gray ] [
      set pcolor green

; Copyright 2015 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 7 years ago by Miguel Torez.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.