Edge index
An edge index is a tensor-based representation that records graph edges as pairs of source and destination node indices.
Build AI Drug Discovery Pipelines
edge_index is a two-row sparse tensor that records source and destination node indices for graph edges.
- How it is used
- Represents sparse molecule and protein connectivity for graph neural network message passing and drug-target affinity prediction.
- How deep it goes
- Explains row semantics, COO sparsity, dimensions, bidirectional edges, self-loops, and Data-object construction.
- Examples
- Uses a 20-atom molecule with 25 bidirectional bonds and self-loops, plus a PyTorch Geometric Data construction listing.
- What you can do after
- Operate/configure PyTorch Geometric Data objects by building edge_index tensors from graph connectivity.
Read how Build AI Drug Discovery Pipelines explains edge index →
Knowledge Graphs and LLMs in Action
An edge index is a tensor-based representation that encodes graph edges as pairs of source and destination node indices.
- How it is used
- Prepares graph connections for PyG graph construction, GNN message passing, link prediction, and scalable mini-batch loading.
- How deep it goes
- Explains ID remapping, tensor construction, heterogeneous relations, reverse edges, and edge splitting, without detailing tensor internals.
- Examples
- Uses financial transactions and MovieLens user-movie ratings, including mapped IDs, tensor samples, and concrete edge counts.
- What you can do after
- Build it from scratch by mapping endpoint IDs and stacking source-destination arrays into a PyTorch edge_index tensor.
Read how Knowledge Graphs and LLMs in Action explains edge index →
What to know first
- graph neural networkA graph neural network is a neural-network model that learns representations or predictions from graph-structured data by combining information from connected entities.
Related concepts
- COO formatkind of · COO format is a sparse data representation that stores each nonzero entry with its coordinate indices and value.
- PyTorch Geometricused by · PyTorch Geometric is an open-source Python library that extends PyTorch with data structures and operators for graph and geometric machine learning.
- tensorkind of · A tensor is a multidimensional numerical array whose values are arranged along indexed dimensions and can be manipulated through mathematical computation.
- graphpart of · A graph is a mathematical structure consisting of vertices and edges that connect pairs of vertices to represent relationships or connections.
Questions about edge index
What is edge index?
An edge index is a tensor-based representation that records graph edges as pairs of source and destination node indices.
Which Manning books explain edge index?
Build AI Drug Discovery Pipelines and Knowledge Graphs and LLMs in Action.
What should I know before learning edge index?
Manning books that teach edge index usually introduce graph neural network first.
What is edge index a kind of?
Edge index is a kind of COO format. COO format is a sparse data representation that stores each nonzero entry with its coordinate indices and value.
What is edge index part of?
Edge index is part of graph. A graph is a mathematical structure consisting of vertices and edges that connect pairs of vertices to represent relationships or connections.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

