liveBook · Manning

Undirected edge

As explained in D3.js in Action, Third Edition

An undirected edge is a network connection that is valid in both directions between its endpoint nodes.

An undirected edge represents a connection that works equally in both directions between two nodes. Its source and target labels identify the endpoints, but their order does not change the relationship. section 12.1

Represent undirected edges by following these practical rules:

  • Store one edge for each connected node pair in an edge list with source and target columns. section 12.1
  • Treat source and target interchangeably when the relationship has no meaningful direction. section 12.1
  • Attach a weight when the connection has measurable strength, such as the number of shared scenes. section 12.1
  • Duplicate each edge in both directions when converting it for an adjacency matrix, producing symmetric matrix entries. section 12.2

Shared scenes in Romeo and Juliet

An edge connecting Lady Capulet and the Nurse has weight 1 because they share one scene. The Nurse and Juliet Capulet have weight 2. Either character can appear as source or target. section 12.1

Figure 12.2 Network edges have a source and a target. In directed networks, the direction of the connection is meaningful and often represented by an arrow. In undirected networks, there’s no specific direction to the relationship.
figure

Compare undirected edges with directed edges: arrows express meaningful direction only for the directed case. section 12.1

Figure 12.4 Adjacency matrix of Romeo and Juliet. The characters, or nodes, are listed along the x-axis and y-axis, while the number of scenes they share, the edges, are communicated by the filled grid squares. The darker the square, the more scenes the two characters share. Adjacency matrices of undirected networks are symmetric, but they can also visualize directed networks, for which they become asymmetric.
figure

See how undirected edges become symmetric filled cells in an adjacency matrix, with darker cells representing larger weights. section 12.2

How D3.js in Action, Third Edition covers it

How deep it goes
Defines endpoint symmetry, weights, and matrix conversion, but stops short of broader graph algorithms.
Examples
Uses shared scenes between Romeo and Juliet characters, weighted edge tables, JSON data, and symmetric matrix cells.
What it assumes
Assumes familiarity with nodes and source-target edge lists while demonstrating the representation from basic data.
What you can do after
Build an adjacency matrix from undirected edges by generating both source-target orientations.
How it connects
Connects undirected edges with nodes, edge lists, edge weights, directed edges, and adjacency matrices.

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.