DOC PREVIEW
Duke CPS 100E - Graph Algorithms

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 100E39.1Graph Algorithmsÿ Topological Sort  Produce a valid ordering of all nodes, given pairwiseconstraints  Solution usually not unique  When is solution impossible? ÿ Topological Sort Example: Getting an AB in CPS  Express prerequisite structure  This example, CPS courses only: 6, 100, 104, 108, 110, 130  Ignore electives or outside requirements (can add later)CompSci 100E39.2Topological Sortÿ Topological Sort Algorithm 1. Find vertex with no incoming edges 2. Remove (updating incoming edge counts) and Output 3. Repeat 1 and 2 while vertices remain  Complexity? ÿ Refine Algorithm  Use priority queue?  Complexity? ÿ What is the minimum number of semesters required?  Develop algorithmCompSci 100E39.3Shortest Path (Unweighted) Mark all vertices with infinity (*) exec. starting vertex with 0 Place starting vertex in queue Repeat until queue is empty: 1. Remove a vertex from front of queue 2. For each adjacent vertex marked with *, ÿ process it, ÿ mark it with source distance + 1ÿ place it on the queue.CompSci 100E39.4Shortest Path (Unweighted) Mark all vertices with infinity (*)  Mark starting vertex with 0 Place starting vertex in queue Repeat until queue is empty: 1. Remove a vertex from front of queue 2. For each adjacent vertex marked with *, ÿ process it, ÿ mark it with source distance + 1ÿ place it on the queue. How do we get actual “Path”?CompSci 100E39.5Shortest Path (Weighted): Dijkstra Unmark all vertices and give infinite weight  Set weight of starting vertex at 0 and place in priority queue Repeat until priority queue is empty: 1. Remove a vertex from priority queue ÿ Process and mark (weight now permanent)2. For each adjacent unmarked vertex ÿ Set weight at lesser of current weight and(source weight + path weight)ÿ (This may involve reducing previous weight setting) ÿ Place in priority queue (if not there already)CompSci 100E39.6Shortest Path (Weighted): DijkstraCompSci 100E39.7Shortest Path (Weighted): Dijkstra Mark all vertices with infinity (*)  Mark starting vertex with 0 Place starting vertex in queue Repeat until queue is empty: 1. Remove a vertex from front of queue 2. For each adjacent vertex marked with *, ÿ process it, ÿ mark it with source distance + 1ÿ place it on the queue. How do we get actual “Path”?CompSci 100E39.8Other Graph Algorithmsÿ Traveling Salesman ÿ Spanning Treesÿ Paths with negative


View Full Document

Duke CPS 100E - Graph Algorithms

Documents in this Course
Topics

Topics

9 pages

Lecture

Lecture

3 pages

Notes

Notes

2 pages

Hashing

Hashing

19 pages

Lecture

Lecture

59 pages

Lecture

Lecture

6 pages

Lecture

Lecture

4 pages

Lecture

Lecture

20 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

7 pages

Lecture

Lecture

8 pages

Lecture

Lecture

10 pages

Lecture

Lecture

4 pages

Notes

Notes

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Lecture

Lecture

13 pages

Lecture

Lecture

6 pages

Lecture

Lecture

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

5 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

10 pages

Sets

Sets

14 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Test 1

Test 1

7 pages

Load more
Download Graph Algorithms
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Graph Algorithms and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Graph Algorithms 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?