32
Topic 12 Graphs 1

Topic 12 Graphs 1. Graphs Definition: Two types:

Embed Size (px)

Citation preview

Page 1: Topic 12 Graphs 1. Graphs Definition: Two types:

Topic 12

Graphs 1

Page 2: Topic 12 Graphs 1. Graphs Definition: Two types:

Graphs

• Definition:

• Two types:

Page 3: Topic 12 Graphs 1. Graphs Definition: Two types:

Undirected

Page 4: Topic 12 Graphs 1. Graphs Definition: Two types:

Directed

Page 5: Topic 12 Graphs 1. Graphs Definition: Two types:

Examples/Applications

Page 7: Topic 12 Graphs 1. Graphs Definition: Two types:

Vacuum World (from AI)

Source: centurion2.comWhat belief states could we be in if we do a certain sequence of actions?

Page 9: Topic 12 Graphs 1. Graphs Definition: Two types:

Graphical Models (from machine learning)

Source: wikipedia.org

What was the most likely sequence of weather given the actions (walking, shopping, cleaning) on those days?

Page 10: Topic 12 Graphs 1. Graphs Definition: Two types:

Graphical Models

Source: PRML by Christopher BishopWhat is the most probable configuration that created this image?

Page 11: Topic 12 Graphs 1. Graphs Definition: Two types:

More Definitions• Path:

• Length:

Page 12: Topic 12 Graphs 1. Graphs Definition: Two types:

• Cycle:

• Self-loop:

Page 13: Topic 12 Graphs 1. Graphs Definition: Two types:

• Incident edges

Page 14: Topic 12 Graphs 1. Graphs Definition: Two types:

• Simple graph:

• Acyclic graph:

Page 15: Topic 12 Graphs 1. Graphs Definition: Two types:

• Subgraph:

• Forest:

• Tree

Page 16: Topic 12 Graphs 1. Graphs Definition: Two types:

• Connected:

• Complete graph:

Page 17: Topic 12 Graphs 1. Graphs Definition: Two types:

• Weighted graph:

Page 18: Topic 12 Graphs 1. Graphs Definition: Two types:

Graph Representations

Page 19: Topic 12 Graphs 1. Graphs Definition: Two types:

Adjacency Matrix (undirected)

Page 20: Topic 12 Graphs 1. Graphs Definition: Two types:

Adjacency Matrix (directed)

Pros: Cons:

Page 21: Topic 12 Graphs 1. Graphs Definition: Two types:

Adjaceny list (undirected)

Page 22: Topic 12 Graphs 1. Graphs Definition: Two types:

Adjaceny list (directed)

Page 23: Topic 12 Graphs 1. Graphs Definition: Two types:

Adjacency List Costs

• Space:

• Searching for edge between nodes:

• Adjacency check:

Page 24: Topic 12 Graphs 1. Graphs Definition: Two types:

Graph Search/Traversals

• How do get from one node to another?

• Why?

Page 25: Topic 12 Graphs 1. Graphs Definition: Two types:

Breadth First Search

Page 26: Topic 12 Graphs 1. Graphs Definition: Two types:
Page 27: Topic 12 Graphs 1. Graphs Definition: Two types:

Implementing BFS

Page 28: Topic 12 Graphs 1. Graphs Definition: Two types:
Page 29: Topic 12 Graphs 1. Graphs Definition: Two types:
Page 30: Topic 12 Graphs 1. Graphs Definition: Two types:

Depth-First Search

Page 31: Topic 12 Graphs 1. Graphs Definition: Two types:

Recursive Algorithm

Page 32: Topic 12 Graphs 1. Graphs Definition: Two types:

Iterative Algorithm