For a large sparse graph, the usual representation is:
Undirected Graphs
Graph terminology and applications, the Graph API, representations (edge list, adjacency matrix, adjacency lists), depth-first search, breadth-first search and shortest paths, and connected components.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
All 63 slides
- 1 A l g o r i t h m s
- 2 Slide 2
- 3 Undirected graphs
- 4 Border graph of 48 contiguous United States
- 5 Protein-protein interaction network
- 6 Map of science clickstreams
- 7 Kevin's facebook friends (Princeton network, circa 2005)
- 8 10 million Facebook friends
- 9 The evolution of FCC lobbying coalitions
- 10 Framingham heart study
- 11 The Internet as mapped by the Opte Project
- 12 Graph applications
- 13 Graph terminology
- 14 Some graph-processing problems
- 15 Slide 15
- 16 Graph representation
- 17 Graph representation
- 18 Graph API
- 19 Graph API: sample client
- 20 Graph representation: set of edges
- 21 Graph representation: adjacency matrix
- 22 hash
- 23 Graph representations
- 24 Graph representations
- 25 Adjacency-list graph representation: Java implementation
- 26 Slide 26
- 27 Maze exploration
- 28 Trmaux maze exploration
- 29 Trmaux maze exploration
- 30 Maze exploration: easy
- 31 Maze exploration: medium
- 32 Maze exploration: challenge for the bored
- 33 Depth-Þrst search
- 34 aw Depth-Þrst search demo
- 35 Depth-Þrst search demo
- 36 Design pattern for graph processing
- 37 Depth-Þrst search: data structures
- 38 Depth-Þrst search: Java implementation
- 39 Depth-Þrst search: properties
- 40 Depth-Þrst search: properties
- 41 Depth-Þrst search application: ßood Þll
- 42 Depth-Þrst search application: preparing for a date
- 43 Slide 43
- 44 is
- 45 Breadth-Þrst search demo
- 46 Breadth-Þrst search
- 47 Breadth-Þrst search: Java implementation
- 48 Breadth-Þrst search properties
- 49 Breadth-Þrst search application: routing
- 50 Breadth-Þrst search application: Kevin Bacon numbers
- 51 Kevin Bacon graph
- 52 Breadth-Þrst search application: Erds numbers
- 53 Slide 53
- 54 Connectivity queries
- 55 Connected components
- 56 Connected components
- 57 Connected components
- 58 Connected components demo
- 59 Connected components demo
- 60 Finding connected components with DFS
- 61 Finding connected components with DFS (continued)
- 62 Connected components application: particle detection
- 63 Graph traversal summary
hash
Notes
Adjacency lists: a list of neighbours per vertex; space O(E + V). Used in practice (sparse graphs).
Exam angle
Depth-Þrst search
Notes
DFS: go as deep as possible, backtrack; marks every vertex connected to s in time proportional to the sum of degrees.
is
Notes
BFS: visit vertices in order of distance from s using a QUEUE; finds shortest paths (fewest edges).
Exam angle
Which search finds the path with the fewest edges in an unweighted graph?
BFS uses which data structure?
Connected components
Notes
Connected components: run DFS from each unmarked vertex; label vertices with a component id.