Chapter 9: Fundamental Physics

Section 7: Space as a Network

Implementation [of network properties]

Networks are conveniently represented by assigning a number to each node, then having lists of rules which specify what nodes the connection from a particular node go to. The tetrahedron network from page 476 is for example given in this representation by

{1 {2, 3, 4}, 2 {1, 3, 4}, 3 {1, 2, 4}, 4 {1, 2, 3}}

The list of nodes reached by following up to n connections from node i are then given by

NodeLists[g_, i_, n_] := NestList[Union[Flatten[# /. g]] &, {i}, n]

The network distance corresponding to the length of the shortest path between two nodes is given by

Distance[g_, {i_, j_}] := Length[NestWhileList[Union[Flatten[# /. g]] &, {i}, !MemberQ[#, j] &]] - 1

Image Source Notebooks:

From Stephen Wolfram: A New Kind of Science [citation]