Lecture 6/3: Graphs


June 3, 2020

đź“‚Associated files

Introduction to Graphs

CS 106B: Programming Abstractions

Spring 2020, Stanford University Computer Science Department

Lecturers: Chris Gregg and Julie Zelenski

A simple graph with six vertexes, numbered 1-6. 6 has a single edge to 4. 4 has edges to 3, 5, and 6. 5 has edges 4 and 2. 2 has edges to 3, 1, and 5. 2 has edges to 1, 3, and 5. 1 has an edge to 2.


Slide 2

Announcements


Slide 3

Today's Topics


Slide 4

Graph Motivation 1

A map of the world showing Facbook connections. The map was drawn only using the connections, in other words, the outline of the countries only comes from the fact that there are people connected via facebook living there


Slide 5

Graph Motivation 2


Slide 6

Graph definition

An image of Morpheus from the Matrix movie, saying 'What if I told you there were no rules?'


Slide 7

Graphs can have cycles


Slide 8

Graphs do not have roots


Slide 9

Weighted Graphs


Slide 10

Different types of graphs: prerequisite graph


Slide 11

Different types of graphs: chemical bonds


Slide 12

Different types of graphs: road maps


Slide 13

Different types of graphs: partisanship


Slide 14

Different types of graphs: Boggle


Slide 15

Different types of graphs: Circuit routing


Slide 16

Different types of graphs: Amazon product relationships



Slide 17

Graph Terms


Slide 18

Loops and cycles


Slide 19

Reachability, connectedness


Slide 20

Representing Graphs in Code


Slide 21

Graph Algorithms