cse101_10_31_11

# cse101_10_31_11 - DFS in directed graphs 1 From last time a...

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

DFS in directed graphs 1. From last time a. A back edge is an edge that leads to an ancestor in the DFS tree. b. Fact (u,w) is a back edge post[u] < post[w] c. Fact: A directed graph is acyclic there are no back edges 2. Directed acyclic graphs (DAGs) a. Ex. Scheduling problem Wake up (1) -> dress (3) -> eat breakfast (4) -> shower (2) -> get kids ready (5) -> get in car (6) Wake up points to all nodes Shower points to dress, dress points to get kids ready In what order to perform these tasks? b. Given a DAG, we want a topological ordering: number the nodes so that every edge goes from a smaller to a larger number. c. It is always possible to topologically order a DAG; order nodes by decreasing post number (linear time) Eat breakfast (1, 4) get in car (2, 3) Shower (5, 10), dress (6, 9) get kids ready (7,8) Wake up (11, 12) Start at highest post number Claim: In any DAG, every edge goes from a bigger post # to a smaller post #. Proof: the only type of edge (u, w) which has POST[u] > POST[u] is a back edge… and a DAG has no back edges.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern