DS-chapter9(NP-completeness修改)

DS-chapter9(NP-completeness修改)

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

View Full Document Right Arrow Icon
CHAPTER 9 Graph Algorithms 9.7 Introduction NP -Completeness Introduction NP -Completeness The Euler circuit problem :find a path that touches every edge exactly once Time is Linear. The Hamiltonian cycle problem :find a simple cycle that contains every vertex. No linear algorithm. The single-source unweighted shortest-path problem for directed graphs is solvable in linear time . The longest-simple –path problem is not solvable in linear time. A brief H quick and informal discussion
Background image of page 1

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

View Full DocumentRight Arrow Icon
Applications of Depth-First Search 3. Euler Circuits Draw each line exactly once without lifting your pen from the paper – Euler tour Draw each line exactly once without lifting your pen from the paper, AND finish at the starting point – Euler curcuit P Proposition H An Euler circuit is possible only if the graph is connected and each vertex has an even degree. HProposition H An Euler tour is possible if there are exactly two vertices having odd degree. One must start at one of the odd- degree vertices.
Background image of page 2
Applications of Depth-First Search 2 6 9 8 3 7 1 12 4 10 5 11 Note: The path should be maintained as a linked list. For each adjacency list, maintain a pointer to the last edge
Background image of page 3

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

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

Page1 / 8

DS-chapter9(NP-completeness修改)

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

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