Top Banner
Graphs David Johnson
32

Graphs

Jan 03, 2016

Download

Documents

yeo-sexton

Graphs. David Johnson. Describing the Environment. How do you tell a person/robot how to get somewhere ? Tell me how to get to the student services building…. World Representation. Landmarks Paths/Roads Map This is abstracted as a graph Not in the sense of a plot. Graphs. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Graphs

Graphs

David Johnson

Page 2: Graphs

Describing the Environment

• How do you tell a person/robot how to get somewhere?– Tell me how to get to the student services building…

Page 3: Graphs

World Representation• Landmarks• Paths/Roads• Map

• This is abstracted as a graph– Not in the sense of a plot

Page 4: Graphs

Graphs• A graph is a set of

landmarks and the paths between them

• A graph G has– Set of vertices (or nodes) V– Set of edges E

• A graph is a classic data structure in CS

V1

V2

V3

E1

E2

Page 5: Graphs

Graphs

• A directed graph means – E(A,B) does not imply

E(B,A)– What kind of robot would

need a graph that is not bidirectional?

• Edges may have weights– Where would this be

appropriate?

V1

V2

V3

E1

E2

1.4

2.6

Page 6: Graphs

Paths

• A path is a sequence of vertices such that for Vi and Vi+1 Ei,i+1 exists

• A graph is connected if there is a path between all V– For what kind of robot and

environment would this not be true?

V1

V2

V3

E1

E2

1.4

2.6

Page 7: Graphs

Imagine a simple robot• What is the simplest

kind of robot you can think of?

Page 8: Graphs

Point Robots

• A point robot can move along the infinitesimal width edges of a graph.

• Path planning for this simple case is just searching a graph for a path.

Page 9: Graphs

Finding Paths

• Given a start and end, how do we find a path between them? V1

V2

V1V3

V4

V7

V6

V8

V5

Page 10: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 11: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 12: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 13: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 14: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 15: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 16: Graphs

Depth First Search (DFS)

• Always take the first option

V1

V2

V1V3

V4

V7

V6

V8

V5

Page 17: Graphs

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 18: Graphs

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 19: Graphs

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 20: Graphs

Breadth First Search (BFS)

• Exhaust all possibilities at same level first V1

V2

V1V3

V4

V7

V6

V8

V5

Page 21: Graphs

Representing a graph in Matlab

• Demo

Page 22: Graphs

Wavefront planner

• Use BFS on a grid• Label cells with values

– Start with zero– Expand from start – Add +1 to neighbors of current wavefront– Use gradient descent to search from goal to

start

Page 23: Graphs

Representations: A Grid

• Distance is reduced to discrete steps– For simplicity, we’ll assume distance is uniform

• Direction is now limited from one adjacent cell to another

Page 24: Graphs

Representations: Connectivity

• 8-Point Connectivity– (chessboard metric)

• 4-Point Connectivity– (Manhattan metric)

Page 25: Graphs

The Wavefront Planner: Setup

Page 26: Graphs

The Wavefront in Action (Part 1)

• Starting with the goal, set all adjacent cells with “0” to the current cell + 1– 4-Point Connectivity or 8-Point Connectivity?– Your Choice. We’ll use 8-Point Connectivity in our example

Page 27: Graphs

The Wavefront in Action (Part 2)

• Now repeat with the modified cells– This will be repeated until goal is reached

• 0’s will only remain when regions are unreachable

Page 28: Graphs

The Wavefront in Action (Part 3)

• Repeat again...

Page 29: Graphs

The Wavefront in Action (Part 4)

• And again...

Page 30: Graphs

The Wavefront in Action (Part 5)

• And again until...

Page 31: Graphs

The Wavefront in Action (Done)

• You’re done

Page 32: Graphs

The Wavefront

• To find the shortest path simply always move toward a cell with a lower number– The numbers generated by the Wavefront planner are roughly

proportional to their distance from the goal

Twopossibleshortestpathsshown