liveBook · Manning

Edge weight

As explained in D3.js in Action, Third Edition

An edge weight is a numeric value associated with a network edge that represents the strength or quantity of its connection.

An edge weight is a number attached to a network connection. In a Romeo and Juliet character network, it counts the scenes two characters share, making repeated relationships stronger than one-time connections. section 12.1

Use the weight when preparing and displaying network data:

  • Store each link with source, target, and weight fields. section 12.1
  • Represent undirected links in both directions when constructing an adjacency matrix, while preserving the same weight. section 12.2
  • Encode stronger weights with darker color or greater opacity, and provide a legend that maps visual intensity to values. section 12.2
  • Reveal the exact weight interactively, such as showing shared-scene counts in a tooltip when a matrix square is hovered. section 12.2

Shared scenes as weights

A link between Lady Capulet and the Nurse has weight 1, the Nurse and Juliet Capulet have weight 2, and Romeo Montague and Juliet Capulet have weight 1. In an adjacency matrix, the Nurse–Juliet squares therefore appear darker than the other listed connections. section 12.1 section 12.2

Table 12.3 Links list for the sample dataset
Source
Target
Weight
Lady Capulet
Nurse
1
Nurse
Juliet Capulet
2
Romeo Montague
Juliet Capulet
1

Inspect the sample edge list to compare source, target, and numeric weight values directly. section 12.1

How D3.js in Action, Third Edition covers it

How deep it goes
Explains storage, bidirectional matrix preparation, opacity mapping, legends, and tooltips without developing broader network analysis.
Examples
Demonstrates shared-scene counts among Lady Capulet, the Nurse, Juliet Capulet, and Romeo Montague.
What it assumes
Assumes familiarity with nodes, source-target edge lists, and network connections while building weighted matrix handling.
What you can do after
Apply it via D3.js to encode connection strength with color, opacity, legends, and interactive tooltips.
How it connects
Connects edge weight with nodes, edges, adjacency matrices, directed networks, undirected networks, and D3.js.

Also explained in

Compare how 3 books explain edge weight →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of D3.js in Action, Third Edition. The section links point to the parts of the book it draws on.