# Graphs – Searching for Relationships COMP 200 & COMP 130 John Greiner & Stephen Wong.

## Presentation on theme: "Graphs – Searching for Relationships COMP 200 & COMP 130 John Greiner & Stephen Wong."— Presentation transcript:

Graphs – Searching for Relationships COMP 200 & COMP 130 John Greiner & Stephen Wong

Graphs – A Reminder Vertices/nodes + edges connecting vertices 1 3 2 5 4 Directed 1 3 2 5 4 Undirected

Social graph How are you connected to someone else? Math co-authors, centered on Paul Erdös.

Can Introducing Hepocyte Growth Factor Lead to Apoptosis?

How are Two Species Related?

How to Solve a Maze? 8

Solving a Maze: Right-Hand Rule 9 Good when you don’t know the maze layout.

How to Get to Work? 10

How to Route Email?

Focus on Three Algorithms Depth-first Search Breadth-first Search Dijkstra’s Shortest Path 12 First, just quick introductions to each.

Depth- vs. Breadth-First Search 13 17 2 3 8 9 5 4 6 12c 2b 2a 3c 4b 3b 3a 4a DFSBFS

Dijkstra’s Shortest Path 14 4 5 3 2 7 1 8 2 3 4 0

Dijkstra’s Shortest Path 15 4 5 3 2 7 1 8 2 3 4 0 7? 3? 4?

Dijkstra’s Shortest Path 16 4 5 3 2 7 1 8 2 3 4 0 7? 3 4?

Dijkstra’s Shortest Path 17 4 5 3 2 7 1 8 2 3 4 0 5? 3 4? 8?

Dijkstra’s Shortest Path 18 4 5 3 2 7 1 8 2 3 4 0 5? 3 4 8?

Dijkstra’s Shortest Path 19 4 5 3 2 7 1 8 2 3 4 0 5? 3 4 8? 6? 12?

Dijkstra’s Shortest Path 20 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8? 6? 12?

Dijkstra’s Shortest Path 21 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8? 6 12?

Dijkstra’s Shortest Path 22 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 12?

Dijkstra’s Shortest Path 23 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 9?

Dijkstra’s Shortest Path 24 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 9

Dijkstra’s Shortest Path 25 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 913? 12?

Dijkstra’s Shortest Path 26 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 913? 12

Dijkstra’s Shortest Path 27 4 5 3 2 7 1 8 2 3 4 0 5 3 4 8 6 913 12

Download ppt "Graphs – Searching for Relationships COMP 200 & COMP 130 John Greiner & Stephen Wong."

Similar presentations