~/ learn/ comp-372/ cards/ Graph Algorithms I: Search, Order, Connectivity
1 of 24

Type the adjacency-list build for one directed edge (u,v)

Type the adjacency-list build for one directed edge (u,v)

Answer

adj[u].append(v)

A directed edge adds v to u’s list only. An undirected edge would also do adj[v].append(u). This is the one-line core of every graph build.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/091861f8-2250-4227-901b-7a75d3ec14c6/flashcard utf-8 LF