liveBook · Manning

Edge list

As explained in Graph Neural Networks in Action

An edge list is a graph representation consisting of records that enumerate the graph's edges and their incident nodes.

An edge list represents a graph as an array of edges, with each entry recording a connected pair of nodes. It provides a simple format for converting raw relationship data into graph-processing or GNN inputs. section 8.3 section 8.3.2

Use an edge list in a practical graph-data pipeline:

  • Extract relationship data from JSON or other raw sources and transform it into node and edge records that satisfy the graph schema. section 8.3.2
  • Write each connected node pair to a text or CSV file, commonly alongside an adjacency list. section 8.3.2
  • Load the serialized representation into NetworkX for exploration and visualization, or into PyTorch Geometric for preprocessing. section 8.3.2

Creating an edge-list file

A relationship dictionary can be traversed by source node and destination node. For each connection, the implementation writes a space-separated pair such as “source destination” and records the pair so an undirected edge is not emitted twice. section 8.3.2

Figure 8.9 A graph with nodes and edges marked (top). An edge list representation (middle); each entry contains the edge number and the pair of nodes connected. An adjacency list representation in a dictionary (bottom); each key is a node, and the values are its adjacent nodes.
figure

Compare the graph itself with its edge-list representation: each entry shows the pair of nodes connected by an edge. section 8.3.2

How Graph Neural Networks in Action covers it

How deep it goes
Defines edge lists and demonstrates serialization from a relationship dictionary, but defers broader graph-data-model details.
Examples
Uses recruiting relationships, CSV files, a relationship dictionary, and a function that writes node pairs to an edge-list file.
What it assumes
Assumes basic nodes and relationships, while defining graph representations, degree, masks, raw data, and serialization.
What you can do after
Build it from scratch by converting relationship data into a serialized edge-list file for NetworkX or PyTorch Geometric.
How it connects
Connects edge lists with adjacency lists, adjacency matrices, NetworkX, PyTorch Geometric, and graph neural networks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.