{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 11 - Graph - 4 slides per page

# Lecture 11 - Graph - 4 slides per page - SARS and CS1102...

This preview shows pages 1–9. Sign up to view the full content.

1 Graphs NUS CS1102 2 SARS and CS1102 b Question : Given a population of N, how many rounds of infections is needed to infect all N people? b Answer : O(log N) NUS CS1102 3 Readings b Textbook s [Carrano] ch13 pg727-770 b Exercise s 1,2,3 NUS CS1102 4 Linked list

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 NUS CS1102 5 Tree NUS CS1102 6 Directed graph vertex (node) edge Tree: unique path Graph: multiple paths NUS CS1102 7 Example: travel planning shopping mall direct route 5 cost NUS CS1102 8 Weighted directed graph 5 3 -2 5 1 0
3 NUS CS1102 9 Undirected graph NUS CS1102 10 Complete graph O(n^2) NUS CS1102 11 Path a c d e b Path, length,simple path NUS CS1102 12 Cycle a c g d e b f Simple cycle

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 NUS CS1102 13 Disconnected graph Applications NUS CS1102 15 Travel Planning shopping mall direct route 5 cost NUS CS1102 16 Question b What is the shortest way to travel between A and B? SHORTEST PATH PROBLEM b How to minimize the cost of visiting n cities such that we visit each city exactly once, and finishing at the city where we start from? “TRAVELING SALESMAN PROBLEM (TSP)”
5 NUS CS1102 17 Internet computer network link NUS CS1102 19 Question b What is the shortest route to send a packet from A to B? SHORTEST PATH PROBLEM NUS CS1102 20 The Web web page web link

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 NUS CS1102 21 Question b Which web pages are important? b Which set of web pages are likely to be of the same topic? NUS CS1102 22 Module Selection module prerequisite NUS CS1102 23 Question b Find a sequence of modules to take that satisfy the prerequisite requirements. “TOPOLOGICAL SORT” NUS CS1102 24 Terrorist suspects knows
7 NUS CS1102 25 Question b Who are the important figures in a terrorist network? NUS CS1102 26 NUS CS1102 27 Epidemic Studies patient contact NUS CS1102 28 Other applications b Biology b VLSI layout b Vehicle routing b Job scheduling b Facility location : :

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 Implementation NUS CS1102 30 Formally A graph G = (V, E, w), where s V is the set of vertices s E is the set of edges s w is the weight function NUS CS1102 31 Example V = { a, b, c } E = { (a,b), (c,b), (a,c) } w = { ((a,b), 4), ((c, b), 1), ((a,c),-3) } a b c 4 1 -3 NUS CS1102 32 Adjacent vertices b adj(v) = set of vertices adjacent to v adj(a) = {b, c} adj(b) = {} adj(c) = {b} b v |adj(v)| = |E| b adj(v): Neighbours of v a b c 4 1 -3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 25

Lecture 11 - Graph - 4 slides per page - SARS and CS1102...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online