


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Pdf for graph theory and trees useful for btech students in every college
Typology: Lecture notes
1 / 34
This page cannot be seen from the preview
Don't miss anything!
Section 1.4: Graphs and Trees A graph is a set of objects (called vertices or nodes ) and edges between pairs of nodes. Vertices = {Ve, G, S, F, Br, Co, Eq, Pe, Bo,Pa, Ch, A, U} Edges = { {Ve,G}, {Ve,Br}, … }
Br Ve Co Eq Ch Pa Bo Pe
A path from vertex x 0 to xn is a sequence of edges x 0 , x 1 , …, xn, where there is an edge from xi-1 to xi for 1≤i≤n. The length of a path is the number of edges in it. A cycle is a path that begins and ends at the same vertex and has no repeated edges.
Br Ve Co Eq Ch Pa Bo Pe
The sequence Co , Br , G , Ve , Co is a cycle. The sequence S , F , S is not a cycle, since edge { S , F } occurs twice. In-class quiz: What is the longest path from Bo to F with distinct edges and no cylces?
Br Ve Co Eq Ch Pa Bo Pe
The sequence Co , Br , G , Ve , Co is a cycle. The sequence S , F , S is not a cycle, since edge { S , F } occurs twice. In-class quiz: What is the longest path from Bo to F with distinct edges and no cylces? A graph is n-colorable if its vertices can be colored using n different colors such that adjacent vertices have different colors. The chromatic number of a graph is the smallest such n. In-class quiz: What is the chromatic color of this graph? i.e., how many colors does it take to color this graph?
Br Ve Co Eq Ch Pa Bo Pe
A graph traversal starts at some vertex v and visits all vertices without visiting any vertex more than once. (We assume connectedness: all vertices are reachable from v.) Breadth-First Traversal
Br Ve Co Eq Ch Pa Bo Pe
A graph traversal starts at some vertex v and visits all vertices without visiting any vertex more than once. (We assume connectedness: all vertices are reachable from v.) Breadth-First Traversal
Br Ve Co Eq Ch Pa Bo Pe
A graph traversal starts at some vertex v and visits all vertices without visiting any vertex more than once. (We assume connectedness: all vertices are reachable from v.) Breadth-First Traversal
Br Ve Co Eq Ch Pa Bo Pe
In-Class Quiz: Find a breadth-first traversal starting with F. A D
In-Class Quiz: Find a breadth-first traversal starting with F. One answer: F,H,D,G,B,A,E,C In-Class Quiz: Find a breadth-first traversal starting with C. One answer: C,A,E,D,F,B,H,G A D
Depth-First Traversal Start with a vertex v and visit all reachable vertices. Start by going as far as you can. Then backup a little and go down another path as far as possible. Only backup as far as necessary, then try the next path. Example: Start at Ch. Ch S
Br Ve Co Eq Ch Pa Bo Pe
Depth-First Traversal Start with a vertex v and visit all reachable vertices. Start by going as far as you can. Then backup a little and go down another path as far as possible. Only backup as far as necessary, then try the next path. Example: Start at Ch. Ch,Pe,Co,Ve,G,S,F,Br,Eq S
Br Ve Co Eq Ch Pa Bo Pe
Depth-First Traversal Start with a vertex v and visit all reachable vertices. Start by going as far as you can. Then backup a little and go down another path as far as possible. Only backup as far as necessary, then try the next path. Example: Start at Ch. Ch,Pe,Co,Ve,G,S,F,Br,Eq,A,U S
Br Ve Co Eq Ch Pa Bo Pe
In-Class Quiz: Find a depth-first traversal starting a F. A D
In-Class Quiz: Find a depth-first traversal starting a F. One Answer: F,H,G,D,B,A,C,E In-Class Quiz: Find a depth-first traversal starting a E. A D