AlgoScope

Multigraph

Allows parallel edges and self-loops.

Data structures, data structure, intermediate
Edge 0 to 1, count 1.012301230100100000000000
Edge 0 to 1, count 1.012301230100100000000000

Matrix: Multigraph: cells count edges, loops count twice

Decision, step 2 of 8

Edge 0-1: cells (0, 1) and (1, 0) go from 0 to 1, the same as in a simple graph. 1 of 6 edges placed.

How matrix works

Cost

Add edge
O(1)
Space
O(V + E)

Before this

Taught by the same lesson

Matrix covers these too, in the same run.