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

Homogeneous vs Heterogeneous Graphs

Distinguish graphs with single node/edge types from heterogeneous graphs with multiple typed entities and relations.

Homogeneous vs Heterogeneous Graphs

You'll learn how to distinguish between simple graphs with uniform entities and complex graphs with multiple types of nodes and relationships.

The Core Distinction

Until now, we've worked with homogeneous graphs where all nodes represent the same type of entity and all edges represent the same type of relationship. Think of a social network where every node is a person and every edge is a "friendship" connection.

A heterogeneous graph contains multiple types of nodes and/or multiple types of edges. Imagine a movie database: you have "Movie" nodes, "Actor" nodes, and "Director" nodes, connected by "acted_in" and "directed" edges. The nodes and relationships are fundamentally different from each other.

Why This Matters

In homogeneous graphs, you can apply the same processing logic to every node because they're all the same kind of thing. The adjacency matrix or adjacency list directly captures all the structure you need.

In heterogeneous graphs, different node types may have completely different feature sets (a movie has a release year, an actor has an age), and different edge types carry different semantic meanings. You need to track these type distinctions explicitly because "a Movie connected to an Actor via 'acted_in'" means something entirely different from "a Movie connected to a Director via 'directed'."

Practical Example

  • Homogeneous: Citation network (all nodes are papers, all edges are citations)
  • Heterogeneous: E-commerce graph (users, products, categories; edges like "purchased," "viewed," "belongs_to")

Key Takeaway: Homogeneous graphs have uniform node and edge types with shared features, while heterogeneous graphs contain multiple entity types with distinct attributes and diverse relationship types requiring type-aware processing.