Download presentation
Presentation is loading. Please wait.
Published byIsaac Sims Modified over 8 years ago
1
Week 6 - Monday
2
What did we talk about last time? Artificial intelligence Lab 5
6
Vertices (Nodes) Edges
7
Friendships on Facebook Nodes: People Edges: Friendship Routes between cities Nodes: Cities Edges: Streets Steps in a task Nodes: Subtasks Edges: Decisions 6 degrees of Kevin Bacon Nodes: Actors Edges: Whether or not they've been in a movie together
8
Labeled Weighted ColoredColoredColoredColored Multigraphs E E A A D D B B F F C C 5 6 4 4 3 5 2 E A D B F C 5 3 7 1
9
When a weighted graph obeys the triangle inequality, the direct route to a node is always fastest
10
Some graphs have edges with direction Example: One way streets Reachability? ONE WAY
11
Often we talk about connected graphs But, not all graphs have to be connected
12
Complete graphs Every node is connected to every other How many edges? |E| = ½(n(n – 1)) = ½(n 2 – n) is O(n 2 )
13
We can talk about a part of a graph For example, what is the largest complete subgraph in this graph? E E A A D D B B F F C C
14
A path is a sequence of connected nodes The cost or weight of the path is usually the sum of the edge weights This path from A to C costs 5 E E A A D D B B F F C C 5 6 4 4 3 5 2 7 3 3
15
A cycle is a path that starts at a node and comes back to the same node How many cycles of length 3 does this graph have? What about 4? 5? 6? E E F F C C A A D D B B A A D D B B
16
A tour is a path that visits every node and (usually) returns to its starting node In other words, it's a cycle that visits every node This tour costs 24 E E A A D D B B F F C C 5 6 4 4 3 5 2 7 3 3
18
A bipartite graph is one whose nodes can be divided into two disjoint sets X and Y There can be edges between set X and set Y There are no edges inside set X or set Y A graph is bipartite if and only if it contains no odd cycles
19
A A B B C C D D E E F F A A B B C C D D E E F F X Y
20
A perfect matching is when every node in set X and every node in set Y is matched It is not always possible to have a perfect matching We can still try to find a maximum matching in which as many nodes are matched up as possible
21
1. Come up with a legal, maximal matching 2. Take an augmenting path that starts at an unmatched node in X and ends at an unmatched node in Y 3. If there is such a path, switch all the edges along the path from being in the matching to being out and vice versa 4. If there is another augmenting path, go back to Step 2
22
A A B B C C D D E E F F A A B B C C D D E E F F X Y Anna Becky CaitlinDaisyErinFiona Adam Ben CarlosDanEvanFred
25
Stable marriage Euler paths and tours Minimum spanning trees Lab 6
26
Lab is Wednesday this week! Start working on Project 2 Read Python Chapter 5 Think about what you want to do for your Final Project Proposal due by 10/28
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.