May 2019
Beginner to intermediate
650 pages
14h 50m
English
Another common way to represent a network is with a pair of arrays: a list of nodes and a list of links (also called an adjacency list). Each link contains references to its adjacent nodes, and may contain a value, if weighted. We generated node-link structures in the previous chapter using d3.hierarchy to represent rooted trees (which are connected undirected graphs with a single root and no cycles).
The matrix data shown in the last section could be represented as the list structure shown below (see Adjacency/2-node-link.html):
const edges = [ {source: 0, target: 1, value: 6}, {source: 0, target: 2, value: 2}, {source: 1, target: 0, value: 8}, {source: 1, target: 2, value: 5}, {source: 2, target: 1, value: 1}, {source: ...Read now
Unlock full access