# lec14 - Lecture 14 Connectedness in graphs Spanning trees...

This preview shows pages 1–13. Sign up to view the full content.

Page 1 of 29 CSE 100, UCSD: LEC 14 Lecture 14 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim’s and Kruskal’s algorithms Intro to disjoint subsets and union/find Reading: Weiss, Ch. 9, Ch 8

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

View Full Document
Page 2 of 29 CSE 100, UCSD: LEC 14 Connectedness of graphs Some definitions: An undirected graph is connected if For every vertex v in the graph, there is a path from v to every other vertex A directed graph is strongly connected if For every vertex v in the graph, there is a path from v to every other vertex A directed graph is weakly connected if The graph is not strongly connected, but the underlying undirected graph (i.e., considering all edges as undirected) is connected A graph is completely connected if for every pair of distinct vertices v 1, v 2, there is an edge from v 1 to v 2
Page 3 of 29 CSE 100, UCSD: LEC 14 Connected graphs: an example Consider this undirected graph: Is it connected? Is it completely connected? V0 V1 V4 V6 V5 V2 V3

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

View Full Document
Page 4 of 29 CSE 100, UCSD: LEC 14 Strongly/weakly connected graphs: an example Consider this directed graph: Is it strongly connected? Is it weakly connected? Is it completely connected? V0 V1 V4 V6 V5 V2 V3
Page 5 of 29 CSE 100, UCSD: LEC 14 Spanning trees We will consider spanning trees for un directed graphs A spanning tree of an undirected graph G is an undirected graph that... contains all the vertices of G contains only edges of G has no cycles is connected So, only connected graphs have spanning trees A spanning tree is called “spanning” because it connects all the graph’s vertices A spanning tree is called a “tree” because it has no cycles (recall the definition of cycle for undirected graphs) What is the root of the spanning tree? you could pick any vertex as the root; the vertices adjacent to that one are then the children of the root; etc.

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

View Full Document
Page 6 of 29 CSE 100, UCSD: LEC 14 Spanning trees: examples Consider this undirected graph G: V0 V1 V4 V6 V5 V2 V3
Page 7 of 29 CSE 100, UCSD: LEC 14 Spanning tree? Ex. 1 Is this graph a spanning tree of G? V0 V1 V4 V6 V5 V2 V3

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

View Full Document
Page 8 of 29 CSE 100, UCSD: LEC 14 Spanning tree? Ex. 2 Is this graph a spanning tree of G? V0 V1 V4 V6 V5 V2 V3
Page 9 of 29 CSE 100, UCSD: LEC 14 Spanning tree? Ex. 3 Is this graph a spanning tree of G? V0 V1 V4 V6 V5 V2 V3

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

View Full Document
Page 10 of 29 CSE 100, UCSD: LEC 14 Spanning tree? Ex. 4 Is this graph a spanning tree of G? V0 V1 V4 V6 V5 V2 V3
Page 11 of 29 CSE 100, UCSD: LEC 14 Multiple spanning trees In general a graph can have more than one spanning tree. All these are spanning trees of that graph G (and there are more): Note: The spanning tree for a graph with N vertices always has N-1 edges (like a tree!) V0 V1 V4 V6 V5 V2 V3 V0 V1 V4 V6 V5 V2 V3 V0 V1 V4 V6 V5 V2 V3 V0 V1 V4 V6 V5 V2 V3

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

View Full Document
Page 12 of 29 CSE 100, UCSD: LEC 14 Finding a spanning tree in an unweighted graph A spanning tree in an unweighted graph is easy to construct...
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern