Course contentsShow
← Machine Learning and Deep Learning
Lesson 2486 of 3,53854. Graph Neural NetworksFree lesson

Node Features, Edge Features, and Graph-Level Attributes

Attach feature vectors to nodes and edges; define global graph attributes for representation in ML tasks.

Node Features, Edge Features, and Graph-Level Attributes

What You'll Learn

You'll learn how to enrich graph data structures with feature vectors at three levels—nodes, edges, and the entire graph—to prepare them for machine learning tasks.

The Three Levels of Graph Features

So far, you've seen graphs as structures: nodes connected by edges. But for machine learning, we need numerical representations of the information each part carries.

Node Features

Each node can have a feature vector attached to it. Think of a social network: each person (node) might have features like age, location, number of posts, or interests encoded as numbers. In a molecule graph, each atom (node) could have features like atomic number, charge, or hybridization state.

Edge Features

Edges aren't just connections—they can carry information too. In a road network, an edge between two cities might have features like distance, travel time, or road type. In a molecular graph, bonds (edges) have features like bond type (single, double, triple) or bond angle.

Graph-Level Attributes

Sometimes you need to describe the entire graph with a single feature vector. For a molecule, this might be its solubility or toxicity label. For a social network, it could be the community's overall sentiment or size category. These global attributes help when your task is to classify or predict properties of whole graphs, not just individual nodes.

Why This Matters

Graph neural networks operate on these features. Node features get transformed and aggregated through the network layers. Edge features influence how information flows between neighbors. Graph-level attributes provide supervision signals for learning tasks like graph classification.

Key Takeaway: Attaching feature vectors to nodes, edges, and entire graphs transforms graph structures into rich, learnable representations for machine learning—enabling networks to reason about local properties, relationships, and global patterns simultaneously.