# 24. Graph IV MST.pdf - One problem: Determine if an...

• 6

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 3 out of 6 pages.

One problem:Determine if an undirected graph contains any cyclesApproach 1DFSfrom sourceKeep going until you see a marked vertexDon't count the node you come fromΘ(V + E)Approach 2WeightedQuickUnionUFobject (disjoint set)At first no vertices are connected.For each edge, check if the two vertices are connectedif not, union themif so, find the circleO(V + E log* V)Spanning TreesSpanning (⽣成树)Given anundirectedgraph, a spanning tree T is a subgraph of G, where T:Is connected--- first two properties make it a treeIs acyclicIncludes all of the vertices --- This makes it spanningMinimum spanning treeA spanning tree of minimum total weightExample: directly connecting buildings by power lines.
MSTMST vs. SPTThe MST sometimes happens to be an SPT for a specific vertexCut PropertyAcutis an assignment of a graph's nodes to two non-empty sets.Acrossing edgeis an edge which connects a node from one set to a node from theother set.

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 6 pages?

Course Hero member to access this document

Term
Spring
Professor
Lee
Tags