100 likes | 108 Views
Discover the concepts of paths and cycles in graphs, including Euler and Hamiltonian paths. Learn how to find these paths efficiently using Depth First Search. Join us for an interactive workshop to enhance your data structures knowledge.
E N D
WORKSHOP LEADERINTEREST MEETINGFRIDAY, APRIL 6th12:30pm 601 CSB Good grades in CSC171 & CSC172 Good people skills Favorable approach to workshops
GRAPHS GRAPH G= (V,E) V: a set of vertices (nodes) E: a set of edges connecting vertices V An edge is a pair of nodes Example: V = {a,b,c,d,e,f,g} E = {(a,b),(a,c),(a,d),(b,e),(c,d),(c,e),(d,e),(e,f)} a b c d e f g
PATHS ON GRAPHS Simple Euler Hamiltonian
SIMPLE PATH Given two vertices is there a simple path that connects them?
HAMILTONIAN PATH Given a starting vertex is there a path through the graph that visits each (and every) vertex exactly once? If the path finishes at the starting vertex, it is a Hamiltonian cycle (a.k.a. The Traveling Salesman Problem).
EULER PATH Given a starting vertex is there a path through the graph that traverses each (and every) edge exactly once?
SIMPLE PATH Given two vertices is there a simple path that connects them? We can find this path in linear O(V + e) time Sort of, recall that e is O(V2) Use Depth first search. How can we modify DFS to print the path?
HAMILTONIAN PATH Given a starting vertex is there a path/cycle/tour through the graph that visits each (and every) vertex exactly once? In order to do this, we may need to consider every possible path. (How many are there?) We may need to consider (V-1)! paths in a complete graph.
EULER PATH Given a starting vertex is there a path through the graph that traverses each (and every) edge exactly once? We can prove that an Euler cycle exists iff the graph is connected and all nodes have even degree. We can find the path in linear time.