depthfirstsearch - 1 15.082 and 6.855J Depth First Search 2...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 15.082 and 6.855J Depth First Search 2 Initialize LIST Unmark all nodes in N; Mark node s 1 2 4 5 3 6 9 7 8 1 pred(1) = 0 next := 1 order(next) = 1 LIST:= {1} next 1 1 2 4 5 3 6 9 7 8 1 1 3 Select a node i in LIST LIST In depth first search, i is the last node in LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 1 1 4 If node i is incident to an admissible arc LIST Select an admissible arc (i,j) 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 Mark Node j pred(j) := i 2 Next := Next + 1 order(j) := next add j to LIST 2 2 5 Select the last node on LIST LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 2 2 2 1 2 Node 2 gets selected 6 3 If node i is incident to an admissible arc LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 2 2 2 1 2 Select an admissible arc (i,j) Mark Node j pred(j) := i Next := Next + 1 order(j) := next add j to LIST 4 3 4 7 3 Select LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 2 2 2 1 2 Select the last node on LIST 4 3 4 2 4 8 3 If node i is incident to an admissible arc LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 2 2 2 1 2 4 3 4 2 4 Select an admissible arc (i,j) Mark Node j pred(j) := i Next := Next + 1 order(j) := next add j to LIST 8 4 4 8 9 3 Select LIST 1 2 4 5 3 6 9 7 8 1 1 next 1 2 1 1 2 2 2 1 2 3 4 2 4 8 4 4 8 Select the last node on LIST 4 8 10...
View Full Document

Page1 / 30

depthfirstsearch - 1 15.082 and 6.855J Depth First Search 2...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online