An Experiment in Resuscitating Twenty Year Old Code
Shawn Graham, Carleton University
Pedro Trapero Fernández, Universidad de Cádiz
shawn.graham@carleton.ca || scholar.social/@electricarchaeo || slides.com/shawngraham/tsr
or
archival photo, SG at CAA 2006 (or at least, it felt like this).
Language models are word calculators
Language models' core technologies are neural networks built for semantic translation
Language models already ate Travellersim years ago.
"I see you're trying to update Graham & Steiner 2006..."
The strategy for updating the code
- write in pseudo-code, to replicate the original paper's goals and understanding
- translate one function at a time; add functions cumulatively to the process
- cross-check syntax across language models
- for the most part, used local models via Jan/Ollama on a Mac Studio M3, or Carleton local models.
There are 28 Netolog versions between 2006 & 2026, including 4 major complete rewrites.
Current version of netlogo is 7.0.4
Original (2006); rewrite (2026)
importance of origin site
importance of destination site
last bit is the cost of movement
...which combined gives the probability of a traveller moving
ifelse is-turtle? destination1 or is-turtle? destination2 or is-turtle? destination3
[ let templist [ ]
let x1 [importance] of destination1 ;; ~ R + W's 'attractiveness of site j'
let y1 distance-nowrap destination1
let z1 0
ask destination1 [set z1 length visitors ;; ~ R + W's 'k value for site j'
if z1 = 0 [set z1 1]
]
let score1 (( x1 ^ benefit-of-resources) * (e ^ (- (difficulty-of-communications * y1))))
/ (z1 ^ benefit-of-resources) * (e ^ (- (difficulty-of-communications * y1)))if any? potential-targets [
let choice rnd:weighted-one-of potential-targets [
(([importance] of origin ^ alpha-exponent) *
(importance ^ beta-exponent) *
(exp (- distance-decay-lambda * (distance origin * meters-per-patch))))
]core function
Reproduction: same analysis + same data → same result
Replication: same analysis + different data → same result
Robustness: same data + different analysis → same result
Generalizability: different data + different analysis → same result
things get complicated, which is why you don't often see people trying to replicate or reproduce other people's studies.
...it looks kinda the same; broad patterns seem to reoccur as in 2006...
But SG06 didn't publish the resulting generated network files, so... at best, we can call this a quasi reproduction
Can a different class of model return results that match the 2026 implementation of Travellersim's gravity model mechanism?
Or the probability of a given network shape is a function of various network features
Decision to try this inspired by Brughmans, Keay, and Earl 2014 on visibility networks in Roman Spain
...enter the ERGM
Do structural social rules (ERGM) and economic gravity (Rihll-Wilson) produce different regional hierarchies on the same landscape?
Experiment
test one: can the two models produce the same network?
test two: do local social structures (ERGM: peer-to-peer ties, community cliques) create a different hierarchy than Model 2's economic gravity
Rome, Veii, confluence of the Anio / Tiber
suggests geographic determinism underpinning layout shape, regardless of model
Geography
gives us shape,
but not winners
RW travellers and where they end up
tighter this is, the more geography overrules social
Gravity vs Social Structure
Tiber Valley
...so, we've now reproduced the original work, and we've replicated it to a degree, insofar as is possible given the very poor data sharing practices of the 2006 version of SG.
...the use of a different model on the same data: and we've kinda shown there's a bit of robustness.
Reproduction: same analysis + same data → same result
Replication: same analysis + different data → same result
Robustness: same data + different analysis → same result
Generalizable: different data + different analysis → same result
Gravity Model + Italy: 2026 version seems to reproduce 2006 results
Gravity Model + Italy versus ERGM: seems to complicate 2006 results
Gravity Model + Spain, ERGM + Spain → ??
...did I mention this is all still a bloody mess of files on my machine? A work in progress...
But.
If we can accept that Travellersim (2026 version) with its gravity model and ergm mechanisms seem to be surfacing something, then we have a tool for exploring other places.
Maybe.
Let's find out!
Guadalquivir
- because this is a smaller area than the Tiber Valley, we increase the distance decay to represent 5 km worth of 'working day' travel (rather than a day's worth of linear travel)
- we sweep parameters again because of equifinality, so that we have most comparable model hyper settings
- we ask the same two questions again
The models suggest some sites as 'important' (various measures) where archaeological materials would seem to agree ie 12, 15, 38
The two models draw attention to the positionality of certain sites like 45 and 9, which may be mansio-type intermediary places
But if we chose 'importance' via traditional archaeological measures, these sites would not necessarily stand out
Which perhaps implies that structural measures and archaeological richness are not necessarily functions of similar things
Jaccard similarity, plotted against geography, nodes sized for simple betweeness
Guadalquivir dataset does not include full range of site sizes: how would the gravity model / ergm change when these places are added (ports, city of Hasta Regia, near 54) - Travellersim original data is from the protohistoric period when sites like eg Rome are not all that differentiated from other possible important places.
Guadalquivir data is just villas - what happens when the full range of rural settlement is included? It might confirm that villas are villas partly from functional/structural positioning - if we did not already know which sites were villas, could the model help us identify which sites are most likely to have performed comparable roles? Could it identify supposedly minor sites as possibly major, thus directing fieldwork efforts?
Deploy the models against another dataset from another region: are the patterns observed here specific to this landscape or do similar structural behaviours emerge elsewhere in the Roman world?
This would make it possible to compare not only two territories, but also the effects of changing the composition of the network within each territory: villas alone; villas plus major settlements and specialised sites; and a much broader rural settlement dataset including minor sites.
And with new code, data shared as csv, and the underlying simulation well-documented, commented, and up-to-date, the work becomes reproducible, replicable, and robust.
Useful networks can be generated using ABM or other modeling approaches
Multiple models against the same data can be compared
Networks from archaeological materials can be used as a kind of control.
shawngraham.github.io
ERGM: Exponential Random Graph Model. Assumes that spatial networks are driven by social rules balanced against physical distance
Gravity Model: Networks emerge from non-linear economic feedback loops
Stigmergy: indirect coordination through the environment
Time: in ERGM, it's static; the model searches for a stable configuration. In Gravity model, it's dynamic and path-dependent (early events compound later structures)
Space: in ERGM, it's considered globally, where the model calculates between any two nodes to convert to probability reward/penalty. In Gravity, it's a physical friction navigated locally
Mechanism: in ERGM a Markov Chain Monte Carlo approach proposes adding/removing ties, which are evaluated against target structural parameters. In Gravity, agents use a retail gravity formula to choose destinations; these leave stigmergic traces; settlement importance is updated dynamically, and the more visitors balanced triggers rich-get-richer feedback loops, which colours the map through influence (visitors from important places are more important than from lesser places).
- Geometric central Greece - digitized by hand in 2005 to reproduce the maps used in the original Rihll and Wilson model
- Protohistoric Italy - digitized by hand in 2005 from an amalgamation of maps published by Cifani (2003:149-150), Smith (1996:240), and Potter (1979:54). See Graham and Steiner 2006: 55
- Guadalquivir - data courtesy of Pedro Trapero Fernández
Netlogo can read CSV files; the best way to share such data then is a simple table using easting and northings to give the site location, with whatever numeric data in columns to use for starting conditions. The 2026 Travellersim model can read both csv and image data and scale appropriately. In the case of image data, it reads for pixels of a particular colour value to work out the scale of the image. This is a left-over kludge from the abilities of Netlogo 3 and not recommended for future work.
A future iteration of Travellersim Redux will only read csv data, and use image files only for cosmetic background. An alternative approach might be to code in Python for the Mesa ABM package, or to develop a plugin approach for something like QGIS.
To compare models, use flow betweeness (traffic bottlenecks) for the gravity model and social betweeness (topological bottlenecks) for the EGRM.
EGRM is deterministic while Gravity depends on starting conditions; sweeping the model space for both means making sure to start from a list of seeds. Thus if a site is important across all runs, we see something important about the geographic distribution of sites; but if its highly variable, we're seeing path dependency.
Thus, before comparisons can be made, we need to make sure things are apples-to-apples. Both model spaces are swept to identify small world conditions. Then, we the comparison is run, we are comparing two different mechanisms against the same data that should result in the same global large-scale network properties: thus the details can be studied for insight.