3 Pages

L-15

Course: CPS 230, Fall 2009
School: Duke
Rating:
 
 
 
 
 

Word Count: 1673

Document Preview

15 October Meeting 25, 2005 Minimum Spanning Trees When a graph is connected, we may ask how many edges we can delete before it stops being connected. Depending on the edges we remove, this may happen sooner or later. The slowest strategy is to remove edges until the graph becomes a tree. Here we study the somewhat more difcult problem of removing edges with a maximum total weight. The remaining graph is then a...

Register Now

Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> CPS 230

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
15 October Meeting 25, 2005 Minimum Spanning Trees When a graph is connected, we may ask how many edges we can delete before it stops being connected. Depending on the edges we remove, this may happen sooner or later. The slowest strategy is to remove edges until the graph becomes a tree. Here we study the somewhat more difcult problem of removing edges with a maximum total weight. The remaining graph is then a tree with minimum total weight. Applications that motivate this question can be found in life support systems modeled as graphs or networks, such as telephone, power supply, sewer systems, etc. etc. Free trees. An undirected graph (U, T ) is a free tree if it is connected and contains no cycle. We could impose a hierarchy by declaring any one vertex as the root and thus obtain a rooted tree. Here, we have no use for a hierarchical organization and exclusively deal with free trees. The a e c d f b Minimum spanning trees. For the remainder of this section, we assume that we also have a weighting function, w : E R. The weight of subgraph is then the total weight of its edges, w(T ) = eT w(e). A minimum spanning tree, or MST of G is a spanning tree that minimizes the weight. The denitions are illustrated in Figure 61 which shows a graph of solid edges with a minimum spanning tree of bold edges. A generic algorithm a 1.5 1.3 1.4 2.5 1.6 1.2 0.9 3.6 b 1.9 e 1.4 1.2 1.3 c d 1.6 f 1.1 2.8 g h i Figure 61: The bold edges form a spanning tree of weight 0.9 + 1.2 + 1.3 + 1.4 + 1.1 + 1.2 + 1.6 + 1.9 = 10.6. g h i for constructing an MST grows a tree by adding more and more edges. Let A E be a subset of some MST of a connected graph (V, E). An edge uv E A is safe for A if A {uv} is also subset of some MST. The generic algorithm adds safe edges until it arrives at an MST. A = ; while (V, A) is not a spanning tree do nd a safe edge uv; A = A {uv} endwhile . As long as A is a proper subset of an MST there are safe edges. Specically, if (V, T ) is an MST and A T then all edges in T A are safe for A. The algorithm will therefore succeed in constructing an MST. The only thing that is not yet clear is how to nd safe edges quickly. Figure 60: Adding the edge dg to the tree creates a single cycle with vertices d, g, h, f, e, a. number of edges of a free tree is always one less than the number of vertices. Whenever we add a new edge (connecting two old vertices) we create exactly one cycle. This cycle can be destroyed by deleting any one of its edges, and we get a new free tree, as in Figure 60. Let (V, E) be a connected and undirected graph. A subgraph is another graph (U, T ) with U V and T E. It is a spanning tree if it is a free tree with U = V . 49 Cuts. To develop a mechanism for identifying safe edges, we dene a cut, which is a partition of the vertex set into two complementary sets, V = W (V W ). It is crossed by an edge uv E if u W and v V W , and it respects an edge set A if A contains no crossing edge. The denitions are illustrated in Figure 62. component. The complementary set V W contains all other vertices, and crossing edges connect the component with its complement. Prims algorithm. Prims algorithm chooses safe edges to grow the tree as a single component from an arbitrary rst vertex s. Similar to Dijkstras algorithm, the vertices that do not yet belong to the tree are stored in a priority queue. For each vertex i outside the tree, we dene its priority V [i].d equal to the minimum weight of any edge that connects i to a vertex in the tree. If there is no such edge then V [i].d = . In addition to the priority, we store the index of the other endpoint of the minimum weight edge. We rst initialize this information. V [s].d = 0; V [s]. = 1; I NSERT(s); forall vertices i = s do V [i].d = ; I NSERT(i) endfor . The main algorithm expands the tree by one edge at a time. It uses marks to distinguish vertices in the tree from vertices outside the tree. while priority queue is non-empty do i = E XTRACT M IN ; mark i; forall neighbors j of i do if j is unmarked and w(ij) < V [j].d then V [j].d = w(ij); V [j]. = i endif endfor endwhile . After running the algorithm, the MST can be recovered from -elds the of the vertices. The algorithm together with its initialization phase performs n = card V insertions into the priority queue, n extractmin operations, and at most m = card E decreasekey operations. Using the Fibonacci heap implementation we get a running time of O(n log n + m), which is the same as for constructing the shortest-path tree with Dijkstras algorithm. Kruskals algorithm. Kruskals algorithm is another implementation of the generic algorithm. It adds edges in a sequence of non-decreasing weight. At any moment, the chosen edges form a collection of trees. These trees merge to form larger and fewer trees, until they eventually combine into a single tree. The algorithm uses a priority queue for the edges and a set system for the vertices. In this context, the term system is just another word for set, Figure 62: The vertices inside and outside the shaded regions form a cut that respects the collection of solid edges. The dotted edges cross the cut. C UT L EMMA . Let A be subset of an MST and consider a cut W (V W ) that respects A. If uv is a crossing edge with minimum weight then uv is safe for A. P ROOF. Consider a minimum spanning tree (V, T ) with A T . If uv T then we are done. Otherwise, let T = T {uv}. Because T is a tree, there is a unique path from u to v in T . We have u W and v V W , so the path switches at least once between the two sets. Suppose it switches along xy, as in Figure 63. Edge xy x u y v Figure 63: Adding uv creates a cycle and deleting xy destroys the cycle. crosses the cut, and since A contains no crossing edges we have xy A. Because uv has minimum weight among crossing edges we have w(uv) w(xy). Dene T = T {xy}. Then (V, T ) is a spanning tree and because w(T ) = w(T ) w(xy) + w(uv) w(T ) it is a minimum spanning tree. The claim follows because A {uv} T . A typical application of the Cut Lemma takes a component of (V, A) and denes W as the set of vertices of that 50 but we will use it exclusively for sets whose elements are themselves sets. Implementations of the set system will be discussed in the next lecture. Initially, A = , the priority queue contains all edges, and the system contains a singleton set for each vertex, C = {{u} | u V }. The algorithm nds an edge with minimum weight that connects two components dened by A. We set W equal to the vertex set of one component and use the Cut Lemma to show that this edge is safe for A. The edge is added to A and the process is repeated. The algorithm halts w...

Textbooks related to the document above:
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - CPS - 001
Todays topics Algorithms Complexity Upcoming AI Reading Brookshear 5.6CompSci 112.1New machines vs. new algorithmsNew machine. Costs $ or more. Makes &quot;everything&quot; finish sooner. Incremental quantitative improvements (Moores La
Duke - CPS - 108
Printed by Owen L. Astrachan Sep 12, 05 9:46package nanogoogle.query;5WordDisplayer.javaPage 1/4Sep 12, 05 9:4675WordDisplayer.javaPage 2/4JMenu fileMenu = new JMenu(&quot;File&quot;); import import import import import import import import java
Duke - CPS - 234
CPS234 Computational Geometry15 September 2005Lecture 6: RIC for Segment IntersectionsLecturer: Pankaj K. Agarwal Scribe: Amber Stillings6.1 Lecture SummaryThis lecture will describe a Randomized Incremental Algorithm (RIC) for Segment Inters
Duke - CPS - 296
Markov games as a framework for multi-agent reinforcement learningMichael L. Littman Brown University / Bellcore Department of Computer Science Brown University Providence, RI 02912-1910 mlittman@cs.brown.eduAbstractIn the Markov decision proces
Duke - CPS - 296
Position AuctionsHal R. Varian . December 2005 Revised: November 1, 2006Abstract I analyze the equilibria of a game based on the ad auction used by Google and Yahoo. This auction is closely related to the assignment game studied by Shapley-Shubik,
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2007 Homework 2 Due date: Friday, Feb 16, 2007, 11.59 PM. Late submissions will not be accepted (unless there are documented excuses from the dean). Submission: In clas
Duke - CPS - 296
Labeling Images with a Computer GameLuis von Ahn and Laura Dabbish School of Computer Science Carnegie Mellon University Pittsburgh, PA, USA {biglou,dabbish}@cs.cmu.eduAbstract We introduce a new interactive system: a game that is fun and can be us
Duke - CPS - 049
Homework 2 sample solution/explanationAzbayar Demberel Department of Computer Science asic@cs.duke.edu February 22, 2007Question 1 Googlewhacking is an attempt to nd queries that return exacly one result when searched by google. It has become a pop
Duke - CPS - 296
QuickRank: A Recursive Ranking AlgorithmAmy Greenwald and John Wicks Department of Computer Science Brown University, Box 1910 Providence, RI 02912 {amy,jwicks}@cs.brown.eduAbstract This paper presents QuickRank, an efcient algorithm for ranking in
Duke - CPS - 049
Sample solution of Quiz 3April 13, 2007Question 1 1) Please recall that Google determines the rank of an ad by AdRank and its formula is: AdRank = Cost Relevance Hence the rank of the web pages would be: Web page AdRank Rank RaleighMazdaAndToyota.
Duke - CPS - 001
Todays topicsDesigning and Implementing Algorithms Problem solving Pseudocode Java Syntax and Grammars Upcoming More Java Acknowledgements Marti Hearst, UC Berkeley David Smith, Georgia tech Reading Computer Science, Chapter 5 Great Ideas, Chapter 2
Duke - CPS - 196
1rGfrGX r r'n nrfnG rnrV f b xag qT d c ` Y p X U U Gif fn }VG T U g e g fh'n ufX T 0v G nrV' b ragX T d c ` Y X U U GWn }VG T i00r vg g
Duke - CPS - 271
Parametric Methods Supervised learningInstance Based Methods ICPS 271 Ron ParrWith content adapted from Lise Getoor (&amp; Tom Dietterich, Ray Mooney, Andrew Moore) Linear classifiers Non-linear classifiers, e.g., neural networks These methods
Duke - CPS - 270
First Order Logic First Order Logic (Predicate Calculus)CPS 270 Ronald Parr Propositional logic is very restrictive Cant make global statements about objects in the world Tends to have very large KBs First order logic is more expressive Relati
Duke - CPS - 196
Contains Joint work with Austin Eliazar New DP-SLAM 2.0 algorithm Fast maintenance of multiple map hypotheses Linear run time in all relevant parameters&quot; ! Results: $ # New model of laser penetration Good asymptoti
Duke - CPS - 140
What will we do in CPS 140? Questions Can you write a program to determine if a string is an integer? 9998.89 8abab 789342 Can you do this if your machine had no additional memory other than the program? (can't store any values and look at them ag
Duke - CPS - 296
Lecture notes 3: Solving linear and integer programs using the GNU linear programming kitVincent ConitzerIn this set of lecture notes, we will study how to solve linear and integer programs using standard solvers. Specically, we will use the GNU li
Duke - CPS - 296
Lecture notes ?: Adding valid inequalities (cutting planes)Vincent Conitzer1IntroductionIn the branch-and-bound algorithm, every time we branch, the program splits into two programs with additional inequalities. We will now consider techniques
Duke - CPS - 182
PUBLISHEDUNITED STATES COURT OF APPEALSFOR THE FOURTH CIRCUITUNITED STATES OF AMERICA, Plaintiff-Appellee, v. RONALD DAVID ELLYSON, Defendant-Appellant. No. 00-4600Appeal from the United States District Court for the Eastern District of Nor
Duke - CPS - 124
OpenGL TutorialCISC 640/440 Computer GraphicsTA: Qi Li/Mani Thomas qili@cis.udel.edu/manivt@cis.udel.edu02/17/05CISC640/440 OpenGL Tutorial1OpenGL: What is It? GL (Graphics Library): Library of 2-D, 3-D drawing primitives and operations A
Duke - CPS - 124
15-462 Computer Graphics I Lecture 10SplinesCubic B-Splines Nonuniform Rational B-Splines Rendering by Subdivision Curves and Surfaces in OpenGL [Angel, Ch 10.7-10.14]February 21, 2002 Frank Pfenning Carnegie Mellon Universityhttp:/www.cs.cmu.
Duke - CPS - 124
Ray TracingCS 465 Lecture 3Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 1Ray tracing ideaCornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 2Ray tracing algorithmfor each pixel { compute viewing ray intersect ray with s
Duke - CPS - 182
Table of Contents 1. Overview 2. Anonymity and You 2.1 Implications of being Anonymous Online 2.2 Legal Considerations 2.3 Ethical Considerations 2.4 Evaluation of Future Policy 3. Encryption 3.1. Asymmetric Encryption 3.2. Public/Private Key Impleme
Duke - CPS - 182
Censorship in China Part 1 Background and Research I. II. Introduction A. Topic Explore terms, reasons, consequences, procedures, etc. of censorship in China Company Policies explanation of company censorship policies A. Google 1. Abide by the law
Duke - CPS - 182
4/17/06MMORPG's - Virtual Economies Spilling into the Real WorldThe main purpose of this paper is to show that the virtual economies that appear in MMORPG's (Massive Multiplayer Online Role Playing Games) are real economies that can and should be
Duke - CPS - 100
Tools: Solve Computational ProblemsAlgorithmic techniques Brute-force/exhaustive, greedy algorithms, dynamic programming, divide-and-conquer, Programming techniques Recursion, memo-izing, compute-once/lookup, tables, Java techniques java.util
Duke - CPS - 100
Printed by Owen L. Astrachan Jan 30, 08 8:27ArrayListHash.javaPage 1/2Jan 30, 08 8:2775ArrayListHash.javaint bucketIndex = getHash(key); ArrayList&lt;Combo&gt; list = myTable.get(bucketIndex); if (list = null){ list = new ArrayList&lt;Combo&gt;(); myTa
Duke - CPS - 100
Burrows Wheeler Transform BWT efficiency Michael Burrows and David Wheeler in 1994, BWT By itself it is NOT a compression scheme Its used to preprocess data, or transform data, to make it more amenable to compression like Huffman Coding Huf
Duke - APR - 100
Burrows Wheeler Transform BWT efficiency Michael Burrows and David Wheeler in 1994, BWT By itself it is NOT a compression scheme Its used to preprocess data, or transform data, to make it more amenable to compression like Huffman Coding Huf
Duke - CPS - 100
APTs and structuring data/informationAPTs and Class/OO/Java tradeoffsIs an element in an array, Where is an element in an array? DIY: use a loop Use Collections, several options public boolean contains(String[] list, Tradeoffs?If you searc
Duke - JAN - 100
APTs and structuring data/informationAPTs and Class/OO/Java tradeoffsIs an element in an array, Where is an element in an array? DIY: use a loop Use Collections, several options public boolean contains(String[] list, Tradeoffs?If you searc
Duke - CPS - 100
What is Computer Science at Duke?Big Ideas in Computer ScienceWhat we tell you it is A bunch of courses useful in some majors What you want it to be or imagine it to be Independent study, new courses, interdepartmental major Mathematics i
Duke - APR - 100
What is Computer Science at Duke?Big Ideas in Computer ScienceWhat we tell you it is A bunch of courses useful in some majors What you want it to be or imagine it to be Independent study, new courses, interdepartmental major Mathematics i
Duke - CPS - 100
Pieces in GalaxyTripStart with[&quot;, &quot;2 3&quot;, &quot;1 4&quot;, &quot;, &quot;2 5&quot; .]Another piece in GalaxyTripSupposed we have found all the connected components, accounting for all the vertices and we have these sizes: 1, 3, 5Machine 1 depends on 2 and 3 What if
Duke - APR - 100
Pieces in GalaxyTripStart with[&quot;, &quot;2 3&quot;, &quot;1 4&quot;, &quot;, &quot;2 5&quot; .]Another piece in GalaxyTripSupposed we have found all the connected components, accounting for all the vertices and we have these sizes: 1, 3, 5Machine 1 depends on 2 and 3 What if
Duke - CPS - 018
Random Numbers Create a random number generator Random generator; Initialize it generator = new Random(); Generate Random Numbers from 0 to 8 x = generator.nextInt(9); How do you get random numbers from 1 to 10?
Duke - PS - 214
CPS 214: Computer Networks Distributed SystemsJanuary 23, 2007Problem Set 1Instructor: Prof. Bruce Maggs Computer Science Department, Duke UniversityThis problem set has four questions, each with several parts. Answer them as clearly and conci
Duke - PS - 214
CPS 214February 18, 2007Problem Set 2Instructor: Prof. Bruce Maggs Computer Science Department, Duke UniversityThis problem set has three questions. Answer them as clearly and concisely as possible. You may discuss ideas with others in the cla
Duke - CPS - 049
Discussion Report: The Database of IntentionsShivnath Babu Duke University shivnath@cs.duke.eduThis report summarizes the class discussion on &quot;The Database of Intentions&quot;. The assigned reading for this discussion was the first chapter of the book
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Homework 2 Due date: Friday, Feb 29, 2008, 5.00 PM. Late submissions will not be accepted (unless there are documented excuses from the dean). Submission: You shou
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Homework 1 Due date: Thursday, Jan 31, 2008, 1.00 PM (before class). Late submissions will not be accepted (unless there are documented excuses from the dean). Sub
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Exercise 1Question 1 Compute the PageRank of the pages in Figure 1.Page BPage APage CPage DFigure 1: Link graph for Question 1Question 2 Compute the Pag
Duke - CPS - 049
1Chapter 1 Introduction to Program DesignChapter OverviewWhat is a computer program? What are the parts of a program? How are they put together? What kinds of questions does a program designer ask?In this chapter you will learn how a compu
Duke - CPS - 271
Why Neural Networks? Maybe we should make our computers more brain-like:Computers BrainsNeural NetworksCPS 271 Ron ParrComputational Units Storage Units Cycle Time Bandwidth Compute Power108 gates/CPU 1011 neurons 109 bits RAM 1012 bits HD 1
Duke - CPS - 210
Dynamic Voltage ScalingThe question: at what clock rate/voltage should the CPU run in the next scheduling interval? Voltage scalable processors StrongARM SA-2 (500mW at 600MHz; 40mW at 150MHz)(adjust clock based on past window, no process reorde
Duke - CPS - 100
ADTs and vectors, towards linked listslltvector is a class-based implementation of a lower-level data type called an array tvector grows dynamically (doubles in size as needed) when elements inserted with push_back tvector protects against bad
Duke - CPS - 110
I/O Caching and Page ReplacementMemory/Storage Hierarchy 101Very fast 1ns clock Multiple Instructions per cycle&quot;CPU-DRAM gap&quot; memory system architecture (CPS 104) volatile &quot;I/O bottleneck&quot; VM and file caching (CPS 110)P $ SRAM, Fast, Small Expe
Duke - CPS - 271
The Problem Learning Probability DistributionsCPS 271 Ron Parr Observe a sequence of events Predict the probability of future events based upon observations Classical statistical problem Surprisingly subtle issues ariseEvent Spaces We first c
Duke - CPS - 108
Inheritance (language independent)qFirst view: exploit common interfaces in programming Iterator and Comparable in Java, see List/ArrayList/Vector Iterators in STL/C+ share interface by convention/templatesImplementation varies while interfac
Duke - CPS - 210
Tricks (mixed syntax)if (some_condition) / as a hint { LOCK m DO if (some_condition) /the truth {stuff} END Cheap to get info but must check for } correctness; always a slow wayMore TricksGeneral pattern:while (! required_conditions) wait (m, c)
Duke - CPS - 108
Software frameworks/cadaversExperience with OO programming and design shows that design patterns are useful Where do we get the experience? How do we impart experience? What can we use to illustrate patterns in practice? What patterns should we em
Duke - CPS - 210
Power-Aware Ad Hoc RoutingMobicom98 paper Power-Aware Routing in Ad Hoc Networks by Singh, Woo, and Raghavendra What is ad hoc routing? Routing through cooperating wireless nodes that may be mobile (topology changing). Goal: reduce the energy cons
Duke - CPS - 189
Thomas Finley An Empirical Study of Novice Program Comprehension in the Imperative and ObjectOriented Styles by Vennila Ramalingam and Susan Wiedenbeck The title says it all, does it not? The authors sought to determine what differences in comprehens
Duke - CPS - 100
Searching, Maps, HashingqSearching is a very important programming application Consider google.com and other search engines In general we search a collection for a key Vector/List, Tree: O(n) and O(log n) If we compare keys when searching we c
Duke - CPS - 100
Intersection, Union, MultisetsFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanism exists for accessing ind
Duke - CPS - 100
What is Computer Science?What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple - it is
Duke - CPS - 100
Backtracking, Search, HeuristicsqMany problems require an approach similar to solving a maze Certain mazes can be solved using the &quot;right-hand&quot; rule Other mazes, e.g., with islands, require another approach If you have &quot;markers&quot;, leave them at
Duke - CPS - 100
Review of Data StructuresqWeve studied concrete data structures Vectors Homogeneous aggregates supporting random access Linked lists Collections supporting constant-time insertionTrees Combine efficiency of search/insert from vector/linke
Duke - CPS - 110
COMPSCI 110 Operating Systems Who - Introductions How - Policies and Administrative Details Why - Objectives and Expectations What - Our Topic: Operating SystemsHow COMPSCI 110 will work Its all explained on the webhttp:/www.cs.duke.edu/educa
Duke - CPS - 100
Intersection, Union, MultisetsAnatomy of IntersectionFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanis
Duke - CPS - 100
Name: HW 1 - Linked Lists Instructions: This HW is due in-class on Oct. 16. Turn in your work stapled and with your name on every page. This assignment is worth 100 points. You should work on your own, but you can use books/notes. You should not use