Data structures and algorithms lab8

2,443 views
2,289 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,443
On SlideShare
0
From Embeds
0
Number of Embeds
792
Actions
Shares
0
Downloads
59
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Data structures and algorithms lab8

  1. 1. DATA STRUCTURES AND ALGORITHMS LAB 8 Bianca Tesila FILS, April 2014
  2. 2. OBJECTIVES  Connected Graph  Hamiltonian Graph  Eulerian Graph
  3. 3. CONNECTED GRAPH  An undirected graph G = (V, A) is said to be connected if, for any vertices u and v of S, there is a chain from u to v.
  4. 4. CONNECTED GRAPH – CONNECTED COMPONENTS  A connected component (or just component) of an undirected graph is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the supergraph.
  5. 5. CONNECTED GRAPH  Classic problems:  Check whether a graph is connected or not  Find all the connected components of a graph !! DFS is used to determine if a graph is connected or not.
  6. 6. CONNECTED GRAPH !! Exercise: Check whether a graph is connected or not.
  7. 7. HAMILTONIAN GRAPH  Hamiltonian Path (or traceable path): a path in an undirected or directed graph that visits each vertex exactly once.  Hamiltonian Cycle (or Hamiltonian circuit): a Hamiltonian path that is a cycle. That  is, it begins and ends on the same vertex.  Hamiltonian Graph: a graph that contains a Hamiltonian cycle !! Any Hamiltonian cycle can be converted to a Hamiltonian path by removing one of its edges.
  8. 8. HAMILTONIAN GRAPH https://sites.google.com/site/poggiolidiscretemath/graph- theory/hamiltonian-graphs
  9. 9. HAMILTONIAN GRAPH !! Exercise: Check whether a graph is Hamiltonian or not. Hint: If G is a non-oriented with n> = 3 vertices, such that every vertex of G has the degree greater or equal to N / 2, then G is Hamiltonian graph.
  10. 10. EULERIAN GRAPH  Eulerian Trail (or Eulerian path): a trail in a graph which visits every edge exactly once. It can end on a vertex different from the one on which it began.  Eulerian Cycle: an Eulerian trail which starts and ends on the same vertex.  Eulerian Graph: a graph that contains an Eulerian cycle
  11. 11. EULERIAN GRAPH  A graph G, without isolated vertices, is Eulerian if and only if it is connected and the degrees of all vertices are even numbers.  Classic problem: find the Eulerian cycle in a graph. https://sites.google.com/site/poggiolidiscretemath/gr aph-theory/eulerian-graphs
  12. 12. EULERIAN GRAPH !! Exercise: Check whether a graph is Eulerian or not. Hint: A connected graph G is an Euler graph if and only if all vertices of G are of even degree.
  13. 13. EULERIAN VS. HAMILTONIAN GRAPHS !! An Eulerian circuit traverses every edge in a graph exactly once, but may repeat vertices, while a Hamiltonian circuit visits each vertex in a graph exactly once but may repeat edges.
  14. 14. HOMEWORK Finish all the lab assignments.

×