






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Overview
Adjacency Matrix
⇒⇒⇒⇒^ edge between nodes n
, njk
Unweighted graph^ Matrix elements
⇒⇒⇒⇒^ boolean Weighted graph^ Matrix elements
⇒⇒⇒⇒^ weight
Adjacency Matrix
Adjacency List
Adjacency List
Graph Space Requirements Adjacency matrix^2 ½ Nentries (for graph with N nodes, E edges) Many empty entries for large graphs Adjacency list E entries Adjacency Set/Map E entries Space overhead per entry higher than for adjacencylist
Graph Time Requirements
Adj Set/Map O(1)O(1)O(1) O(E/N) O(E/N) O(1) Find edge
Enumerateedges
Delete edge
Insert edge
Adj List Adj Matrix Operation
Recursive Spanning Tree
Construction
Spanning Tree Construction
Depth-First Spanning Tree Example
Breadth-First Spanning Tree Example
Minimum Spanning Tree (MST) Spanning tree with minimum total edge weight Multiple MSTs possible (with same weight)
Algorithms for MST