164
Graph Representations and Algorithms

Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Graph Representations and Algorithms

Page 2: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Announcements

● Second midterm is tomorrow, Thursday, May 31.

● Exam location by last name:● A – F: Go to Hewlett 201.● G – Z: Go to Hewlett 200.

● Covers material up through and including Friday's lecture.

● Comprehensive, but primarily focuses on algorithmic efficiency and data structures.

Page 3: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes connected by edges.

Page 4: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes connected by edges.

Page 5: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes connected by edges.

Nodes

Page 6: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A graph is a mathematical structurefor representing relationships.

A graph consists of a set of nodes connected by edges.

Edges

Page 7: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Representing Graphs

Node Connected To

Vector<Node*> Node*

Map<Node*, Vector<Node*> > We can represent a graph as a map from nodes to the list of nodes each node is connected to.

Page 8: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

As The Crow Flies

San Francisco, CA Washington DC

Dallas, TX

Minneapolis, MN

1777mi

935mi

1540mi

1600mi

1319mi

2200mi

How would we represent this

graph?

How would we represent this

graph?

Page 9: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Karel Goes Ice Skating

.

.

.

.

1

2

1 2

.

right, 80%

right, 20%up, 20%

up, 80% down, 80%

down, 20%right, 20%

left, 80%

right, 80%

left, 80%

up, 80% down, 80%

left, 20%down, 20%

left, 20%up, 20%

How would we represent this

graph?

How would we represent this

graph?

(This graph is called a Markov

model)

(This graph is called a Markov

model)

Page 10: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Keep on Truckin'10' 6” 11' 6” 9' 9”

10' 8” 10' 4” 11' 0”

10' 5” 10' 3” 11' 2”

12' 8”

10' 8”

12' 6”

10' 6”

11' 8”

11' 2”

10' 9”

9' 6”

How would we represent this

graph?

How would we represent this

graph?

Page 11: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Representing Graphs

● Our initial approach of encoding a graph as a Map<Node*, Vector<Node*> > will not work if the edges have extra information associated with them.

● We will need to adopt a different strategy.

Page 12: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Nodes and Arcs

● Idea One: Have two separate types, one for nodes and one for arcs.

● Each node stores the set of arcs leaving that node, plus any extra information.

● Each arc stores the nodes it connects, plus any extra information.

Page 13: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

struct Node { string name; Set<Arc*> arcs; /* … other data … */};

struct Arc { Node* start; Node* finish; /* … other data … */};

struct SimpleGraph { Set<Node*> nodes; Set<Arc*> edges;};

Node depends on Arc …

Node depends on Arc …

… and Arc depends on Node!

… and Arc depends on Node!

Page 14: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A Dependency Graph

Node Arc

SimpleGraph

Page 15: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

struct Node;struct Arc;

struct Node { string name; Set<Arc*> arcs; /* … other data … */};

struct Arc { Node* start; Node* finish; /* … other data … */};

struct SimpleGraph { Set<Node*> nodes; Set<Arc*> edges;};

These are called forward declarations and tell C++ to expect struct definitions later.

They're similar to function prototypes.

These are called forward declarations and tell C++ to expect struct definitions later.

They're similar to function prototypes.

Page 16: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Analyzing our Approach

● Advantages:● Allows arbitrary values to be stored in each

node.● Allows arbitrary values to be stored in each

edge.● Disadvantages:

● No encapsulation; can create arcs without adding them into nodes; can remove nodes without removing corresponding arcs, etc.

● No memory management: Need to explicitly free all nodes we've created.

Page 17: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A Graph Class

● We can use this strategy as the basis for building an encapsulated Graph class.

● Similar to the previous approach:● Stores nodes and edges separately.● Nodes store pointers to edges and vice-versa.

● Fewer drawbacks:● Automatically frees all memory for you.● Ensures that arcs and nodes are linked properly.

Page 18: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Using Graph

● The Graph class we provide you is a template; You must provide the node and arc types.

● For example:

Graph<Node, Arc> g1;

Graph<Node, LengthyArc> g2;

Graph<FlowchartNode, FlowchartArc> g3;

● Requirements:

● The node type must have a string called name and a Set of arc pointers called arcs.

● The arc type must have two pointers to nodes named start and finish.

Page 19: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Graph Types for Distancesstruct USCity;struct USArc;

struct USCity { string name; Set<USArc*> arcs;};

struct USArc { double distance; USCity* start; USCity* finish;};

Page 20: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Graph Types for Robotsstruct RobotLocation;struct Transition;

struct RobotLocation { string name; Set<Transition*> arcs;};

struct Transition { double probability; string event; RobotLocation* start; RobotLocation* finish;};

Page 21: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Graph Algorithms

Page 22: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Depth-First Search

Page 23: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Breadth-First Search

Page 24: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

BFS and DFS

● Depth-first search is good for determining whether or not there exists a path from s to t.● Uses a stack.

● Breadth-first search is good for determining the shortest path from s to t.● Uses a queue.

● What happens if the edges now have different lengths?

Page 25: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Shortest Paths

● You are given a directed graph where each edge has a nonnegative weight.

● Given a starting node s, find the shortest path (in terms of total weight) from s to each other node t.

Page 26: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of
Page 27: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

5

8

6

1

2

2

1

3

6

1

2

1

Page 28: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

5

8

6

1

2

2

1

3

6

1

2

1

Page 29: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0?

5

8

6

1

2

2

1

3

6

1

2

1

Page 30: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

6

1

2

2

1

3

6

1

2

1

Page 31: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5?

8?

5

8

6

1

2

2

1

3

6

1

2

1

Page 32: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8?

5

8

6

1

2

2

1

3

6

1

2

1

Page 33: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8?

11?

7?

5

8

6

1

2

2

1

3

6

1

2

1

Page 34: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8?

11?

7

5

8

6

1

2

2

1

3

6

1

2

1

Page 35: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8?

11?

7

13?

8?5

8

6

1

2

2

1

3

6

1

2

1

Page 36: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

13?

8?5

8

6

1

2

2

1

3

6

1

2

1

Page 37: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

9?

13?

8?5

8

6

1

2

2

1

3

6

1

2

1

Page 38: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

9?

11?

8?5

8

6

1

2

2

1

3

6

1

2

1

Page 39: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

9?

11?

8?5

8

6

1

2

2

1

3

6

1

2

1

Notice how our guess of the path length to this node just changed.

Notice how our guess of the path length to this node just changed.

Page 40: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

9?

11?

8?5

8

6

1

2

2

1

3

6

1

2

1

Page 41: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

11?

7

9?

11?

85

8

6

1

2

2

1

3

6

1

2

1

Page 42: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10?

7

9?

11?

8

9?

5

8

6

1

2

2

1

3

6

1

2

1

Page 43: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10?

7

9?

11?

8

9

5

8

6

1

2

2

1

3

6

1

2

1

Page 44: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10?

7

9

11?

8

9

5

8

6

1

2

2

1

3

6

1

2

1

Page 45: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10?

7

9

10?

8

9

5

8

6

1

2

2

1

3

6

1

2

1

Page 46: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10

7

9

10?

8

9

5

8

6

1

2

2

1

3

6

1

2

1

Page 47: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

0

5

8

10

7

9

10

8

9

5

8

6

1

2

2

1

3

6

1

2

1

Page 48: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

One Possible Approach

● Split nodes into three groups:

Green nodes, where we know the length of the shortest path,

Yellow nodes, where we have a guess of the length of the shortest path, and

Red nodes, where we have no idea what the path length is.

● Repeatedly remove the lowest-cost yellow node, make it green, and update all connected nodes.

13

42?

Page 49: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Dijkstra's Algorithm

● This algorithm for finding shortest paths is called Dijkstra's algorithm.

● One of the fastest algorithms for finding the shortest path from s to all other nodes in the graph.

● There are many ways to implement this algorithm.

Page 50: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

Page 51: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

Page 52: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

A

B

D

C

E

G

H

F

I

Page 53: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

B

D

C

E

G

H

F

I

Page 54: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

Page 55: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

Page 56: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

D

C

E

G

F

I

2

Page 57: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

Page 58: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

Page 59: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

A

B

D

C

G

H

F

I

Page 60: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

EA

B

D

C

G

H

F

I

Page 61: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

EA

B

D

C

G

H

F

I

Page 62: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

EA

B

D

C

G

H

F

I

Page 63: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

EA

B

D

C

G

H

F

I

Page 64: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

EA

B

D

C

G

H

F

I

Page 65: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

EA

B

D

C

G

H

F

I

Page 66: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

EA

B

D

C

G

H

F

I

Page 67: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

EA

B

D

C

G

H

F

I

Page 68: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

EA

B

D

C

G

H

F

I

Page 69: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

EA

B

D

C

G

H

F

I

Page 70: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

EA

B

D

C

G

H

F

I

Page 71: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

EA

B

D

C

G

H

F

I

Page 72: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

EA

B

D

C

G

H

F

I

Page 73: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

EA

B

D

C

G

H

F

I

Page 74: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

EA

B

D

C

G

H

F

I

Page 75: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

EA

B

D

C

G

H

F

I

Page 76: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

EA

B

D

C

G

H

F

I

Page 77: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

EA

B

D

C

G

H

F

I

Page 78: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

EA

B

D

C

G

H

F

I

Page 79: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

EA

B

D

C

G

H

F

I

Page 80: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

EA

B

D

C

G

H

F

I

Page 81: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

Page 82: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

Page 83: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(11) A→B→C

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

Page 84: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(11) A→D→H

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

Page 85: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

(11) A→B→E→F→I→H

Page 86: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(8) A→B→E→F

(13) A→B→E→H

(9) A→D→G

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

Page 87: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A

B

D

C

E

G

H

F

I

5

8

6

1

2

2

1

3

6

1

2

1

(0) A

(8) A→D

(5) A→B

(7) A→B→E

(8) A→B→E→F

(9) A→D→G

(10) A→B→E→F→C

(9) A→B→E→F→I

(10) A→D→G→H

Page 88: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Dijkstra's Algorithm

● Maintain a set of “finished nodes.”

● Add the path of just s to a priority queue with length 0.

● While the queue is not empty:

● Dequeue the current path.● If the end node has not already been

finished:– Mark the end node as finished.– Add to the priority queue all paths formed by

expanding this current path by one step.

Page 89: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Google maps uses a modified version of Dijkstra's algorithm called A* search.

Google maps uses a modified version of Dijkstra's algorithm called A* search.

Page 90: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Minimum Spanning Trees

Page 91: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

61

5

4

8 7 6

7

12

2

9 1

3

Page 92: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

61

5

4

8 7 6

7

12

2

9 1

3

Page 93: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

61

5

4

8 7 6

7

12

2

9 1

3

Page 94: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

61

5

4

8 7 6

7

12

2

9 1

3

Page 95: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A spanning tree in an undirectedgraph is a set of edges with

no cycles that connects all nodes.

Page 96: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

A minimum spanning tree (or MST) is aspanning tree with the least total cost.

Page 97: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Applications

● Electric Grids● Given a collection of houses, where do you

lay wires to connect all houses with the least total cost?

● This was the initial motivation for studying minimum spanning trees in the early 1920's. (work done by Czech mathematician Otakar Borůvka)

● Data Clustering● More on that later...

Page 98: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Kruskal's Algorithm

● Kruskal's algorithm is an efficient algorithm for finding minimum spanning trees.

● Idea is as follows:● Remove all edges from the graph.● Sort the edges into ascending order by length.● For each edge:

– If the endpoints of the edge aren't already connected to one another, add in that edge.

– Otherwise, skip the edge.

Page 99: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 100: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 101: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 102: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 103: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 104: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 105: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 106: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 107: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 108: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 109: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 110: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 111: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

41

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

These two nodes are already connected to

one another!

These two nodes are already connected to

one another!

Page 112: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 113: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 114: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 115: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 116: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

4 3 6

7

4

2

3

5 6

7

5

5

7

6

Page 117: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 118: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

A graph can have many minimum spanning trees. Here, the choice of

which length-4 edge we visit first leads to different results.

A graph can have many minimum spanning trees. Here, the choice of

which length-4 edge we visit first leads to different results.

Page 119: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 120: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 121: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 122: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 123: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 124: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 125: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 126: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 127: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

5 6

7

5

5

7

6

Page 128: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

6

7

5

5

7

6

Page 129: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

6

7

5

5

7

6

Page 130: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

6

3 6

7

4

2

3

6

7

5

5

7

6

Page 131: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3 6

7

4

2

3

6

7

5

5

7

6

Page 132: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3 6

7

4

2

3

6

7

5

5

7

6

Page 133: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3 6

7

4

2

3

6

7

5

5

7

6

Page 134: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

6

7

5

5

7

6

Page 135: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

6

7

5

5

7

6

Page 136: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

6

7

5

5

7

6

Page 137: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

6

Page 138: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

6

Page 139: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

6

Page 140: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

Page 141: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

Page 142: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

Page 143: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

Page 144: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

7

4

2

3

7

5

5

7

Page 145: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

4

2

3

7

5

5

7

Page 146: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

4

2

3

7

5

5

7

Page 147: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

4

2

3

7

5

5

7

Page 148: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

1

4

3

4

2

3

7

5

5

Page 149: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maintaining Connectivity

● One of the key steps in Kruskal's algorithm is determining whether two nodes are connected to one another.

● There are many ways to do this:

● Could do a DFS in the partially-constructed graph to see if the two nodes are reachable from one another.

● Could store a list of all the clusters of nodes that are connected to one another.

● Classiest implementation: use a union/find data structure.

● Check Wikipedia for details; it's surprisingly simple!

Page 150: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

Page 151: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

Page 152: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

● Given a set of points, break those points apart into clusters.

● Immensely useful across all disciplines:● Cluster individuals by phenotype to try to

determine what genes influence which traits.● Cluster images by pixel color to identify

objects in pictures.● Cluster essays by various features to see

how students learn to write.

Page 153: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

Page 154: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

Page 155: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Data Clustering

Page 156: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

What makes a clustering “good?”

Page 157: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

● Maximum-separation clustering tries to find a clustering that maximizes the separation between different clusters.

● Specifically: Maximize the minimum distance between any two points of different clusters.

● Very good on many data sets, though not always ideal.

Page 158: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

Page 159: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

Page 160: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

● It is extremely easy to adopt Kruskal's algorithm to produce a maximum-separation set of clusters.● Suppose you want k clusters.● Given the data set, add an edge from each node

to each other node whose length depends on their similarity.

● Run Kruskal's algorithm until n – k edges have been added.

● The pieces of the graph that have been linked together are k maximally-separated clusters.

Page 161: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

Page 162: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

Page 163: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Maximum-Separation Clustering

Page 164: Graph Representations and Algorithms...algorithmic efficiency and data structures. A graph is a mathematical structure for representing relationships. A graph consists of a set of

Next Time

● Fun and Exciting Extra Topics● Machine learning?● Advanced graph algorithms?● Applications?