Skip to article frontmatterSkip to article content

Phase 2: Links with Behavior


Learning Objectives

By the end of Phase 2, students should be able to:


Conceptual Frame

Now that we can create links, let’s use them to model how people influence each other. Links don’t just represent connections—they’re the channels through which interaction happens. When people are connected, they affect each other. Over time, they become more similar.


What Happens in Phase 2

We implement the mechanisms of influence and tie decay:

  1. Each time step, connected people influence each other, moving opinions toward similarity.

  2. If two people become too different, their link breaks.

No new links form yet (that comes in Phase 3). We’re just observing what happens when these two mechanisms operate.


Key Insights from Phase 2

Question: If people only influence each other to become similar, what happens?

Answer: People in connected clusters converge to similar opinions. BUT, links break between people who are too different. So the network becomes MORE fragmented even though people within groups become more similar.

This demonstrates an important principle: Local similarity and global fragmentation can coexist.


Starter Code for Phase 2

breed [people person]
undirected-link-breed [social-bonds social-bond]

people-own [
  opinion
  influenced?
]

social-bonds-own [strength]

to setup
  clear-all
  
  create-people 20 [
    set opinion random 100
    setxy random-xcor random-ycor
    set size 1
    set influenced? false
    
    ; Color by opinion: red = extreme, blue = moderate
    set color scale-color red opinion 0 100
  ]
  
  ask people [
    create-social-bonds-with n-of 3 other people [
      set strength 0.5
      set color grey
      set thickness 0.3
    ]
  ]
  
  reset-ticks
end

to go
  ask people [ set influenced? false ]
  
  influence-through-links
  break-weak-ties
  
  tick
end

to influence-through-links
  ask people [
    let nbors link-neighbors
    
    if any? neighbors [
      ; Calculate average opinion of nbors
      let avg-neighbor-opinion mean [opinion] of nbors
      
      ; Update opinion: 70% your opinion, 30% average neighbor opinion
      let new-opinion 0.7 * opinion + 0.3 * avg-neighbor-opinion
      
      ; Only update if change is significant
      if abs (new-opinion - opinion) > 0.1 [
        set opinion new-opinion
        set influenced? true
      ]
    ]
    
    ; Update color to reflect new opinion
    set color scale-color red opinion 0 100
  ]
end

to break-weak-ties
  ; If two linked people differ too much, the link breaks
  ask social-bonds [
    let opinion-diff abs ([opinion] of end1 - [opinion] of end2)
    
    if opinion-diff > 50 [
      die  ; Remove the link
    ]
  ]
end

You can find the full starter code here.


Phase 2 Mechanics Explained

Now we turn to explaining the two main processes: influence and tie decay.

The Influence Process

to influence-through-links
  ask people [
    let nbors link-neighbors

    if any? nbors [
      let avg-neighbor-opinion mean [opinion] of nbors
      let new-opinion 0.7 * opinion + 0.3 * avg-neighbor-opinion

      if abs (new-opinion - opinion) > 0.1 [
        set opinion new-opinion
      ]
    ]
  ]
end

This implements a weighted average:

Why weighted average? Because realistic influence is gradual. People don’t instantly change their minds; they move incrementally toward others’ views.

What if 0.7 is smaller? Nbors have MORE influence, opinions converge faster.

What if 0.7 is larger? You’re stubbornness; opinions converge slower.

The Tie Decay Process

to break-weak-ties
  ask social-bonds [
    let opinion-diff abs ([opinion] of end1 - [opinion] of end2)
    
    if opinion-diff > 50 [
      die
    ]
  ]
end

This implements a hard threshold: if people differ by more than 50 opinion points, the relationship breaks.

Why a threshold? At some point, differences become too fundamental to maintain the relationship. This models the idea that relationships have limits.

What if threshold is lower (e.g., 30)? Links break more easily; faster fragmentation.

What if threshold is higher (e.g., 70)? Links persist longer despite disagreement; slower fragmentation.


Classroom Activities - Phase 2

Activity 2.1: Observe Influence

Run the model:

setup
repeat 50 [go]

Answer:

Learning point: Influence makes similar people more similar, but tie decay fragments the network.


Activity 2.2: Modify Influence Strength

Create a more flexible procedure:

to go-with-strength [influence-rate]
  ask people [ set influenced? false ]
  
  influence-through-links-with-rate influence-rate
  break-weak-ties
  
  tick
end

to influence-through-links-with-rate [rate]
  ask people [
    let nbors link-neighbors
    
    if any? nbors [
      let avg-neighbor-opinion mean [opinion] of nbors
      let new-opinion (1 - rate) * opinion + rate * avg-neighbor-opinion
      
      if abs (new-opinion - opinion) > 0.1 [
        set opinion new-opinion
      ]
    ]
    
    set color scale-color red opinion 0 100
  ]
end

Now run two scenarios:

setup
repeat 50 [go-with-strength 0.1]  ; Weak influence

vs.

setup
repeat 50 [go-with-strength 0.5]  ; Strong influence

Answer:

Learning point: Parameter values matter. Small changes in influence strength produce different outcomes.

The final code for this activity can be found here.

Add:

to visualize-strong-ties
  ask social-bonds [
    let opinion-diff abs ([opinion] of end1 - [opinion] of end2)
    ; Thicker lines for people with similar opinions
    set thickness 0.1 + 0.4 * (1 - opinion-diff / 100)
  ]
end

Call this in go:

to go
  ask people [ set influenced? false ]
  influence-through-links
  break-weak-ties
  visualize-strong-ties
  tick
end

Now run and watch:

setup
repeat 100 [go]

Answer:

Learning point: Visualization helps us see mechanisms. Line thickness reveals relationship strength.

The final code for this activity can be found here.

Activity 2.4: Count Fragmentation

Add a simple fragmentation counter:

to-report estimate-components
  let isolated-people count people with [count link-neighbors = 0]
  report isolated-people
end

Answer:

Real-World Parallel: Echo Chambers

Phase 2 demonstrates the echo chamber effect without explicit homophily (new links forming):

Real-world social media shows similar patterns:

Assessment - Phase 2

Students should be able to: