Electrical & Computer Engineering University of Waterloo Canada March 8, 2007
|
|
- Milo Miles
- 5 years ago
- Views:
Transcription
1 Electrical & Computer Engineering University of Waterloo Canada March 8, 2007 Binary Relations I Recall that a binary relation on a set X is a set R X 2. We may interpret a binary relation as a directed graph G = (X, R). Some common axioms relations may satisfy: 1. Transitive (T ): x, y, z. (R(x, y) R(y, z) R(x, z)) If there is a path from x to z, there is an edge from x to z.
2 Binary Relations II 2. Reflexive: x. R(x, x) Every vertex has an edge to itself. 3. Symmetric (S) x, y. R(x, y) R(y, x) If there is an edge from x to y, there is an edge from y to x. Usually one draws the graph without arrows: and it is called simply a graph rather than a directed graph. Binary Relations III 4. Antisymmetric (A) x, y. R(x, y) R(y, x) (x = y) When the relation is reflexive, transitive and also antisymmetric, it is a partial order. A rough classification of : Binary Relation/Directed Graph Graph (S) Preorder/Quasiorder (T,R) Equivalence (T,R,S) Partial order/poset (T,R,A) Tree order Total order
3 Binary Relations IV Good algorithms for managing the common classes of are known. If you can identify the abstract relation(s) underlying a problem, this may lead you directly to efficient algorithms. Part I Equivalence Relations
4 Equivalence relations and partitions I An equivalence relation is a binary relation that is reflexive, transitive, and symmetric. (The most familiar example: equality, = ). Pictured as a graph, an equivalence relation is a collection of cliques: a b e f c d g For an equivalence X 2, we write [a] = {b X : a b} for the equivalence class of a; Equivalence relations and partitions II X / for the set of equivalence classes induced by : X / = {[a] : a X } X / is a partition. (Recall that a partition of a set X is a collection of subsets Y 1,..., Y k of X that are pairwise disjoint and satisfy Y i = X.) Example: In the above figure, the equivalence classes are {{a, b, c, d}, {e, f, g}}. Example: take N with a b (a mod 5 = b mod 5). The equivalence classes N/ are {{0, 5, 10,...}, {1, 6, 11,...},..., {4, 9, 14,...}}. Common algorithmic problems we encounter with equivalence classes: Answering queries of the form Is a b?
5 Equivalence relations and partitions III Maintaining an equivalence relation as we progressively decide objects are equivalent. (This results from an inductively defined equivalence relation.) Example: the Nelson-Oppen method for equational reasoning [7]. Maintaining an equivalence relation as we progressively decide objects are not equivalent. (This results from a co-inductive definition of equivalence [6].) Example: minimizing states of a DFA [4], maintaining bisimulations, congruence closure [3]. A system of representatives is the primary means for efficient manipulation of equivalence relations. A system of representatives for is a function s : (X / ) X choosing a single element from each block of the partition, such that a b if and only if s(a) = s(b) Equivalence relations and partitions IV Example: to reason about equivalence of integers modulo 5, we could choose the representatives 0, 1, 2, 3, and 4. The integer 1 represents the equivalence class [1] = {1, 6, 11, 16,...}. With a means to quickly compute representatives, we can test whether a b by computing the representatives of the equivalence classes [a] and [b], then using equality. If the equivalence relation is static, one can precompute a system of representatives as e.g., a table. If the equivalence relation is discovered dynamically, more sophisticated methods are needed.
6 Disjoint Set Union I Disjoint Set Union is algorithms-speak for maintaining an inductively-defined equivalence relation: Initially we have a set of objects, none of which are known to be equivalent. We gradually discover that objects are equivalent, and we wish to maintain a representation of the equivalence relation that lets us quickly answer queries of the form Is a b? Interface: union(a, b): include a b in the equivalence relation find(a): returns an equivalence class representative (ECR) for a. There is wonderfully elegant data structure due to Tarjan [8] that performs these operations in O(nα(n)) time, where α(n) 3 for n less than (cosmologists best estimate of) the number of particles in the universe. Disjoint Set Union II Tarjan s data structure maintains the equivalence relation on the set X as a forest a collection of trees. Each node in a tree is an element of the set X, each tree is an equivalence class, and each root is an equivalence class representative. a b c d e f g A forest representation of the equivalence classes {{a, b, c, d}, {e, f, g}}. Each element has a pointer to its parent; to determine the equivalence class representative, we follow the parent pointers to the root of the tree.
7 Disjoint Set Union III The efficiency of the representation depends on how deep the trees are. To keep the trees shallow, two techniques are employed: (i) path compression; and (ii) union by rank. Record representation: for each element x X, we track parent(x): a pointer to the parent of x, or a pointer to itself if it is the root (alternately, a null pointer can be used.) rank(x): indicates how deep trees are (but, not depth per se). Pseudocode for find(a): find (a) if parent(a) a then parent(a) find(parent(a)) return parent(a) Disjoint Set Union IV This recursively follows the parent pointers up to the root, then rewrites all the parent pointers so they point directly at the root, called path compression : d f e d f c e c Left: tree. Right: after calling find(c). A simple way to implement union(a,b): just make the root of a s tree have b as a parent. union(a,b) parent( find (a)) b
8 Disjoint Set Union V However, this can lead to poorly balanced trees. For better asymptotic efficiency, one can track how deep the trees are and always make the deeper tree the parent of the shallower tree: called union by rank. union(a,b) pa find(a) pb find(b) if pa=pb then return if rank(pa) > rank(pb) then parent(pb) pa else parent(pa) pb if (rank(pa) = rank(pb)) rank(pb) rank(pa) + 1 Disjoint Set Union VI Tarjan proved that using both path compression and union by rank, a sequence of n calls to union and find requires O(nα(n)) time, where α(n) 3 for > = n >; i.e., a tower of powers-of-two. The function α(n) is the inverse of the Ackermann function; see CLR [2] or [8] for details. For any practical purpose, the time required by Tarjan s algorithm is indistinguishable from O(n) for a sequence of n operations; or O(1) per operation amortized time (to come.)
9 Part II Graphs Representation of Graphs I Here are four common methods of representing graphs. If the graph is large (e.g., infinite), the structure is not known beforehand, etc., we may choose an implicit representation for the graph, where vertices and edges are computed on-the-fly as needed. For example, the graph G = (N, E) where (x, y) E if and only if y divides x, is an infinite graph where the edges can be computed on the fly by factorization. An explicit representation is one where we directly encode the structure of the graph in a data structure. Some common methods for this:
10 Representation of Graphs II Adjacency matrix: an n n matrix A of 0 s and 1 s, with A ij = 1 if and only if v i, v j E. Row i indicates the out edges for vertex i, and column i indicates the in edges. A = b d a c Representation of Graphs III Adjacency lists: each vertex maintains a set of vertices to/from which there is an edge e.g. out(a) = {b, c} out(b) = {d} out(c) = {d} out(d) = If the graph structure is static (i.e., not changing as the algorithm runs), it is common to represent lists of inand out- edges as vectors, for efficiency. For more elaborate algorithms on e.g. weighted graphs, a representation of this sort is commonly used:
11 Representation of Graphs IV public class Edge { Vertex x, y; double weight; } public class Vertex { Set<Edge> out; Set<Edge> in; } Depth-First Search I One of the commonest operations on a graph is to visit the vertices of the graph one by one in some desired order. This is commonly called a search. In a depth-first search, we explore along a single path into the graph as far as we can until no new vertices can be reached; then we return to some earlier point where new vertices are still reachable and continue. (Think of exploring a maze.) Example of a depth-first search (yellow) starting at the center vertex of this graph:
12 Depth-First Search II As we visit each new vertex, we perform some action there. The choice of action depends on what we hope to accomplish; for now we will just call it visiting the vertex, but later we will see examples of specific useful actions. We might choose to visit the vertex the first time we see it (preorder), or the last time we see it (postorder) Here is a recursive implementation of depth-first search. It uses a set Seen to track which vertices have been visited. One can also include a flag field as part of the vertex data structure that can be marked to indicate the vertex has been seen. Depth-First Search III dfs(x) dfs(x, ) dfs(x, Seen) if x Seen Seen Seen {x} preordervisit (x) // Do something For each edge (x, y), dfs(y,seen) postordervisit (x) // Do something This search is easily implemented in a nonrecursive version, using a stack data structure to keep track of the current path into the graph:
13 Depth-First Search IV dfs(x) Seen = Stack S push(s,x) while S is not empty, y pop(s) if y Seen then Seen Seen { y } preordervisit (y) for each edge (y, z), push(s,z) Topological Sort I A Directed Acyclic Graph (DAG) is a graph in which there are no cycles (i.e., paths from a vertex to itself.) The reflexive, transitive closure of a DAG is a partial order. (If you add to a DAG an edge (x, y) whenever there is a path from x to y, plus self-loops (x, x), the resulting edge relation is a partial order: reflexive, transitive, and anti-symmetric.) Every finite partial order can be extended to a total order: i.e., if is a partial order on a finite set, there is a total order such that (x y) (x y); or, more obtusely,. (Axiom of choice implies this for infinite sets also.)
14 Topological Sort II Example: let V = N 2 (pairs of natural numbers), and for all i, j, put edges (i, j) (i + 1, j) and (i, j) (i, j + 1):... Then the transitive reflexive closure of this graph is a partial order where (i, j) (i, j ) if and only if i i and j j : (2, 0) (1, 1) (0, 2) (1, 0) (0, 1) (0, 0) Topological Sort III One way to extend to a total order is:. An example of what computer scientists call dovetailing. Topological sort is a method for obtaining a total-order extension of a partial order.
15 Topological Sort IV Example: Suppose we want to evaluate a digital circuit: a b c Build a graph where signals are vertices, and an edge indicates that one signal depends upon another (a dependence graph ): d e e d c a b Topological Sort V The transitive, reflexive closure of this graph yields an order, where e.g., e d means signal e can be evaluated only after signal d. Extending to a total order gives us a valid order in which to evaluate the signals, e.g., e d c b a If we evaluate signals in the order a, b, c, d, e we respect the dependencies. Other examples: Ordering the presentation of topics in a course or paper. Solving equations Makefiles Planning (keeping track of task dependencies) Spreadsheets and dataflow languages [5] Ordering static initializers in programming languages Dynamization of static algorithms e.g. [1]
16 Topological Sort VI Here is an algorithm for topological sort based on depth-first search. Note that there are many ways in which a partial order can be extended to a total order; this is just one method. TopologicalSort (V,E) Set<Node> visited; List <Node> order; for x V dfs(x, visited, order) dfs(x, visited, order) if x visited visited.add(x) for each out edge (x,y) dfs(y, visited, order) order. insertback(x) Topological Sort VII We search the dependence graph depth-first, visiting vertices postorder at which time we insert them at the back of the list. Example: for the circuit example, a depth-first search might visit the vertices in the order a, b, d, c, e.
17 Connected components of undirected graph I Defn: A set of vertices Y V is connected if for every a, b Y there is a path from a to b. Y is a maximal connected component if it cannot be enlarged, i.e., for any connected set of vertices Y with Y Y, Y = Y. Note that the connected components of a graph form a partition of the vertices: a b q g d c e The connected components are {{a, b, g, q}, {c, d, e}}. Using Tarjan s disjoint set union, there is a very simple algorithm for connected components: Connected components of undirected graph II 1. Have a parent pointer and rank associated with each vertex (e.g., by creating a separate record for each vertex, or by storing these fields directly in the vertex data structure.) 2. For each edge (a, b), call union(a, b). No searching is necessary! The complexity is O( E + V α( E + V )), practically linear in the number of vertices and edges.
18 I [1] Umut A. Acar, Guy E. Blelloch, Robert Harper, Jorge L. Vittes, and Shan Leung Maverick Woo. Dynamizing static algorithms, with applications to dynamic trees and history independence. In SODA 04: Proceedings of the fifteenth annual ACM-SIAM symposium on Discrete algorithms, pages , Philadelphia, PA, USA, Society for Industrial and Applied Mathematics. bib pdf [2] Thomas H. Cormen, Charles E. Leiserson, and Ronald R. Rivest. Intoduction to algorithms. McGraw Hill, bib II [3] Peter J. Downey, Ravi Sethi, and Robert Endre Tarjan. Variations on the common subexpression problem. Journal of the ACM (JACM), 27(4): , bib pdf [4] J. E. Hopcroft. An n log n algorithm for minimizing the states in a finite-automaton. In Z. Kohavi, editor, Theory of Machines and Computations, pages Academic Press, bib [5] Wesley M. Johnston, J. R. Paul Hanna, and Richard J. Millar. Advances in dataflow programming languages. ACM Comput. Surv., 36(1):1 34, bib pdf
19 III [6] Y. N. Moschovakis. Elementary Induction on Abstract Structures. North-Holland, Amsterdam, bib [7] Greg Nelson and Derek C. Oppen. Fast decision procedures based on congruence closure. Journal of the ACM (JACM), 27(2): , bib pdf [8] R. E. Tarjan. Efficiency of a good but not linear disjoint set union algorithm. Journal of the ACM (JACM), 22: , bib pdf
Outline Purpose Disjoint Sets Maze Generation. Disjoint Sets. Seth Long. March 24, 2010
March 24, 2010 Equivalence Classes Some Applications Forming Equivalence Classes Equivalence Classes Some Applications Forming Equivalence Classes Equivalence Classes The class of all things equivelant
More informationBinary Relations McGraw-Hill Education
Binary Relations A binary relation R from a set A to a set B is a subset of A X B Example: Let A = {0,1,2} and B = {a,b} {(0, a), (0, b), (1,a), (2, b)} is a relation from A to B. We can also represent
More informationGraph Algorithms Using Depth First Search
Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth
More informationAdvanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012
topological ordering, minimum spanning tree, Union-Find problem Jiří Vyskočil, Radek Mařík 2012 Subgraph subgraph A graph H is a subgraph of a graph G, if the following two inclusions are satisfied: 2
More informationDisjoint Sets and the Union/Find Problem
Disjoint Sets and the Union/Find Problem Equivalence Relations A binary relation R on a set S is a subset of the Cartesian product S S. If (a, b) R we write arb and say a relates to b. Relations can have
More informationSlides for Faculty Oxford University Press All rights reserved.
Oxford University Press 2013 Slides for Faculty Assistance Preliminaries Author: Vivek Kulkarni vivek_kulkarni@yahoo.com Outline Following topics are covered in the slides: Basic concepts, namely, symbols,
More informationBACKGROUND: A BRIEF INTRODUCTION TO GRAPH THEORY
BACKGROUND: A BRIEF INTRODUCTION TO GRAPH THEORY General definitions; Representations; Graph Traversals; Topological sort; Graphs definitions & representations Graph theory is a fundamental tool in sparse
More informationThomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6
More informationDistributed Data Structures and Algorithms for Disjoint Sets in Computing Connected Components of Huge Network
Distributed Data Structures and Algorithms for Disjoint Sets in Computing Connected Components of Huge Network Wing Ning Li, CSCE Dept. University of Arkansas, Fayetteville, AR 72701 wingning@uark.edu
More informationLecture 22 Tuesday, April 10
CIS 160 - Spring 2018 (instructor Val Tannen) Lecture 22 Tuesday, April 10 GRAPH THEORY Directed Graphs Directed graphs (a.k.a. digraphs) are an important mathematical modeling tool in Computer Science,
More informationAn Implicit Representation of Chordal Comparabilty Graphs in Linear-time
An Implicit Representation of Chordal Comparabilty Graphs in Linear-time Andrew R. Curtis a, Clemente Izurieta b, Benson Joeris c, Scott Lundberg b, Ross M. McConnell,b a Cheriton School of Computer Science,
More informationCS 310 Advanced Data Structures and Algorithms
CS 31 Advanced Data Structures and Algorithms Graphs July 18, 17 Tong Wang UMass Boston CS 31 July 18, 17 1 / 4 Graph Definitions Graph a mathematical construction that describes objects and relations
More information9.5 Equivalence Relations
9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same
More informationUnion-Find: A Data Structure for Disjoint Set Operations
Union-Find: A Data Structure for Disjoint Set Operations 1 The Union-Find Data Structure Purpose: Great for disjoint sets Operations: Union ( S 1, S 2 ) Find ( x ) Performs a union of two disjoint sets
More informationLecture 10: Strongly Connected Components, Biconnected Graphs
15-750: Graduate Algorithms February 8, 2016 Lecture 10: Strongly Connected Components, Biconnected Graphs Lecturer: David Witmer Scribe: Zhong Zhou 1 DFS Continued We have introduced Depth-First Search
More informationCourse Review for Finals. Cpt S 223 Fall 2008
Course Review for Finals Cpt S 223 Fall 2008 1 Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e.,
More informationIntroduction to Algorithms Third Edition
Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Introduction to Algorithms Third Edition The MIT Press Cambridge, Massachusetts London, England Preface xiü I Foundations Introduction
More informationCSCE 750, Fall 2002 Notes 6 Page Graph Problems ffl explore all nodes (breadth first and depth first) ffl find the shortest path from a given s
CSCE 750, Fall 2002 Notes 6 Page 1 10 Graph Algorithms (These notes follow the development in Cormen, Leiserson, and Rivest.) 10.1 Definitions ffl graph, directed graph (digraph), nodes, edges, subgraph
More informationThe Union-Find Problem Is Linear
The Union-Find Problem Is Linear Hantao Zhang Computer Science Department The University of Iowa Iowa City, IA 52242 hzhang@cs.uiowa.edu Abstract The union-find problem, also known as the disjoint set
More informationCSI 604 Elementary Graph Algorithms
CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the
More informationDisjoint Sets. (Disjoint Sets) Data Structures and Programming Spring / 50
Disjoint Sets (Disjoint Sets) Data Structures and Programming Spring 2017 1 / 50 Making a Good Maze What s a Good Maze? Connected Just one path between any two rooms Random The Maze Construction Problem
More informationFoundations of Computer Science Spring Mathematical Preliminaries
Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College
More informationGraph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1
Graph Algorithms Chapter 22 CPTR 430 Algorithms Graph Algorithms Why Study Graph Algorithms? Mathematical graphs seem to be relatively specialized and abstract Why spend so much time and effort on algorithms
More informationElementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:
Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered
More informationCSE 20 DISCRETE MATH. Winter
CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam
More information22c:31 Algorithms. Kruskal s Algorithm for MST Union-Find for Disjoint Sets
22c:1 Algorithms Kruskal s Algorithm for MST Union-Find for Disjoint Sets 1 Kruskal s Algorithm for MST Work with edges, rather than nodes Two steps: Sort edges by increasing edge weight Select the first
More informationA GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY
A GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY KARL L. STRATOS Abstract. The conventional method of describing a graph as a pair (V, E), where V and E repectively denote the sets of vertices and edges,
More informationDISCRETE MATHEMATICS
DISCRETE MATHEMATICS WITH APPLICATIONS THIRD EDITION SUSANNA S. EPP DePaul University THOIVISON * BROOKS/COLE Australia Canada Mexico Singapore Spain United Kingdom United States CONTENTS Chapter 1 The
More informationCS 125 Section #6 Graph Traversal and Linear Programs 10/13/14
CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 1 Depth first search 1.1 The Algorithm Besides breadth first search, which we saw in class in relation to Dijkstra s algorithm, there is one
More informationCOMP Analysis of Algorithms & Data Structures
COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Disjoin Sets and Union-Find Structures CLRS 21.121.4 University of Manitoba 1 / 32 Disjoint Sets Disjoint set is an abstract data type
More informationProvably Efficient Non-Preemptive Task Scheduling with Cilk
Provably Efficient Non-Preemptive Task Scheduling with Cilk V. -Y. Vee and W.-J. Hsu School of Applied Science, Nanyang Technological University Nanyang Avenue, Singapore 639798. Abstract We consider the
More informationData Structures for Disjoint Sets
Data Structures for Disjoint Sets Manolis Koubarakis 1 Dynamic Sets Sets are fundamental for mathematics but also for computer science. In computer science, we usually study dynamic sets i.e., sets that
More informationOn Covering a Graph Optimally with Induced Subgraphs
On Covering a Graph Optimally with Induced Subgraphs Shripad Thite April 1, 006 Abstract We consider the problem of covering a graph with a given number of induced subgraphs so that the maximum number
More informationCpt S 223 Fall Cpt S 223. School of EECS, WSU
Course Review Cpt S 223 Fall 2012 1 Final Exam When: Monday (December 10) 8 10 AM Where: in class (Sloan 150) Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes
More informationPower Set of a set and Relations
Power Set of a set and Relations 1 Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}}
More informationAnalysis of Algorithms
Analysis of Algorithms Concept Exam Code: 16 All questions are weighted equally. Assume worst case behavior and sufficiently large input sizes unless otherwise specified. Strong induction Consider this
More informationUNIT IV -NON-LINEAR DATA STRUCTURES 4.1 Trees TREE: A tree is a finite set of one or more nodes such that there is a specially designated node called the Root, and zero or more non empty sub trees T1,
More informationLecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1
CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture
More informationGraph Representations and Traversal
COMPSCI 330: Design and Analysis of Algorithms 02/08/2017-02/20/2017 Graph Representations and Traversal Lecturer: Debmalya Panigrahi Scribe: Tianqi Song, Fred Zhang, Tianyu Wang 1 Overview This lecture
More informationUnion-Find: A Data Structure for Disjoint Set Operations
Union-Find: A Data Structure for Disjoint Set Operations 1 Equivalence Relations A equivalence relation R is defined on a set S, if for every pair of elements (a,b) in S, a R b is either false or true
More informationCS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting
CS2 Algorithms and Data Structures Note 10 Depth-First Search and Topological Sorting In this lecture, we will analyse the running time of DFS and discuss a few applications. 10.1 A recursive implementation
More informationApplications of BDF and DFS
January 14, 2016 1 Deciding whether a graph is bipartite using BFS. 2 Finding connected components of a graph (both BFS and DFS) works. 3 Deciding whether a digraph is strongly connected. 4 Finding cut
More information15-451/651: Design & Analysis of Algorithms October 5, 2017 Lecture #11: Depth First Search and Strong Components last changed: October 17, 2017
15-451/651: Design & Analysis of Algorithms October 5, 2017 Lecture #11: Depth First Search and Strong Components last changed: October 17, 2017 1 Introduction Depth first search is a very useful technique
More informationAlgorithmic Aspects of Communication Networks
Algorithmic Aspects of Communication Networks Chapter 5 Network Resilience Algorithmic Aspects of ComNets (WS 16/17): 05 Network Resilience 1 Introduction and Motivation Network resilience denotes the
More informationDesign and Analysis of Algorithms
CSE, Winter 8 Design and Analysis of Algorithms Lecture : Graphs, DFS (Undirected, Directed), DAGs Class URL: http://vlsicad.ucsd.edu/courses/cse-w8/ Graphs Internet topology Graphs Gene-gene interactions
More informationAlgorithm Design (8) Graph Algorithms 1/2
Graph Algorithm Design (8) Graph Algorithms / Graph:, : A finite set of vertices (or nodes) : A finite set of edges (or arcs or branches) each of which connect two vertices Takashi Chikayama School of
More informationCHAPTER 8. Copyright Cengage Learning. All rights reserved.
CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation
More informationRound 3: Trees. Tommi Junttila. Aalto University School of Science Department of Computer Science. CS-A1140 Data Structures and Algorithms Autumn 2017
Round 3: Trees Tommi Junttila Aalto University School of Science Department of Computer Science CS-A1140 Data Structures and Algorithms Autumn 2017 Tommi Junttila (Aalto University) Round 3 CS-A1140 /
More informationCS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department
CS473-Algorithms I Lecture 3-A Graphs Graphs A directed graph (or digraph) G is a pair (V, E), where V is a finite set, and E is a binary relation on V The set V: Vertex set of G The set E: Edge set of
More informationToday s Outline. Motivation. Disjoint Sets. Disjoint Sets and Dynamic Equivalence Relations. Announcements. Today s Topics:
Today s Outline Disjoint Sets and Dynamic Equivalence Relations Announcements Assignment # due Thurs 0/ at pm Today s Topics: Disjoint Sets & Dynamic Equivalence CSE Data Structures and Algorithms 0//0
More informationW4231: Analysis of Algorithms
W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally
More informationLecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29
Lecture 13 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
More informationThese notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.
Undirected Graphical Models: Chordal Graphs, Decomposable Graphs, Junction Trees, and Factorizations Peter Bartlett. October 2003. These notes present some properties of chordal graphs, a set of undirected
More informationCourse Review. Cpt S 223 Fall 2010
Course Review Cpt S 223 Fall 2010 1 Final Exam When: Thursday (12/16) 8-10am Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & class notes Homeworks & program
More informationMAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.
MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public.it-sudparis.eu/~gibson/teaching/mat7003/ Graphs and Trees http://www-public.it-sudparis.eu/~gibson/teaching/mat7003/l2-graphsandtrees.pdf
More informationUnion-find algorithms. (1) How do you determine whether a vertex x is connected to a vertex y in a graph?
Union-find algorithms Consider the following problems: (1) How do you determine whether a vertex x is connected to a vertex y in a graph? (2) Let vertices correspond to objects and edges mean "is in the
More informationA Deterministic Polynomial-time Algorithm for the Clique Problem and the Equality of P and NP Complexity Classes
Vol:, No:9, 008 A Deterministic Polynomial-time Algorithm for the Clique Problem and the Equality of P and NP Complexity Classes Zohreh O. Akbari Abstract In this paper a deterministic polynomial-time
More informationInterval Stabbing Problems in Small Integer Ranges
Interval Stabbing Problems in Small Integer Ranges Jens M. Schmidt Freie Universität Berlin, Germany Enhanced version of August 2, 2010 Abstract Given a set I of n intervals, a stabbing query consists
More informationarxiv: v1 [cs.ds] 3 Oct 2017
ORDERED DAGS: HYPERCUBESORT MIKHAIL GUDIM arxiv:70.00v [cs.ds] Oct 07 Abstract. We generalize the insertion into a binary heap to any directed acyclic graph (DAG) with one source vertex. This lets us formulate
More informationLECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS
Department of Computer Science University of Babylon LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS By Faculty of Science for Women( SCIW), University of Babylon, Iraq Samaher@uobabylon.edu.iq
More informationGraph and Digraph Glossary
1 of 15 31.1.2004 14:45 Graph and Digraph Glossary A B C D E F G H I-J K L M N O P-Q R S T U V W-Z Acyclic Graph A graph is acyclic if it contains no cycles. Adjacency Matrix A 0-1 square matrix whose
More informationNotation Index. Probability notation. (there exists) (such that) Fn-4 B n (Bell numbers) CL-27 s t (equivalence relation) GT-5.
Notation Index (there exists) (for all) Fn-4 Fn-4 (such that) Fn-4 B n (Bell numbers) CL-27 s t (equivalence relation) GT-5 ( n ) k (binomial coefficient) CL-15 ( n m 1,m 2,...) (multinomial coefficient)
More informationMaintaining Disjoint Sets
Maintaining Disjoint Sets Ref: Chapter 21 of text. (Proofs in Section 21.4 omitted.) Given: A collection S 1, S 2,..., S k of pairwise disjoint sets. Each set has a name, its representative, which is an
More informationCSE 20 DISCRETE MATH. Fall
CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam
More informationGraphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs
Graphs and Network Flows ISE 411 Lecture 7 Dr. Ted Ralphs ISE 411 Lecture 7 1 References for Today s Lecture Required reading Chapter 20 References AMO Chapter 13 CLRS Chapter 23 ISE 411 Lecture 7 2 Minimum
More informationDynamic algorithms: Introduction
Dynamic algorithms F04.Q4, March 26, 2004 Dynamic algorithms: Introduction Most algorithms that we have seen so far have been static in that the input was given initially and our task has been to compute
More informationCS Data Structures and Algorithm Analysis
CS 483 - Data Structures and Algorithm Analysis Lecture VI: Chapter 5, part 2; Chapter 6, part 1 R. Paul Wiegand George Mason University, Department of Computer Science March 8, 2006 Outline 1 Topological
More informationControl-Flow Analysis
Control-Flow Analysis Dragon book [Ch. 8, Section 8.4; Ch. 9, Section 9.6] Compilers: Principles, Techniques, and Tools, 2 nd ed. by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jerey D. Ullman on reserve
More informationCHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science
CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science Entrance Examination, 5 May 23 This question paper has 4 printed sides. Part A has questions of 3 marks each. Part B has 7 questions
More informationSolutions to Exam Data structures (X and NV)
Solutions to Exam Data structures X and NV 2005102. 1. a Insert the keys 9, 6, 2,, 97, 1 into a binary search tree BST. Draw the final tree. See Figure 1. b Add NIL nodes to the tree of 1a and color it
More informationDefinition of Graphs and Trees. Representation of Trees.
Definition of Graphs and Trees. Representation of Trees. Chapter 6 Definition of graphs (I) A directed graph or digraph is a pair G = (V,E) s.t.: V is a finite set called the set of vertices of G. E V
More information1 Connected components in undirected graphs
Lecture 10 Connected components of undirected and directed graphs Scribe: Luke Johnston (2016) and Mary Wootters (2017) Date: October 25, 2017 Much of the following notes were taken from Tim Roughgarden
More informationMore Complicated Recursion CMPSC 122
More Complicated Recursion CMPSC 122 Now that we've gotten a taste of recursion, we'll look at several more examples of recursion that are special in their own way. I. Example with More Involved Arithmetic
More informationAdvanced Set Representation Methods
Advanced Set Representation Methods AVL trees. 2-3(-4) Trees. Union-Find Set ADT DSA - lecture 4 - T.U.Cluj-Napoca - M. Joldos 1 Advanced Set Representation. AVL Trees Problem with BSTs: worst case operation
More informationGraph: representation and traversal
Graph: representation and traversal CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang! Acknowledgement The set of slides have use materials from the following resources Slides for textbook
More informationDecreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )
Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 1. if >. 2. error new key is greater than current key 3.. 4.. 5. if NIL and.
More informationSELF-BALANCING SEARCH TREES. Chapter 11
SELF-BALANCING SEARCH TREES Chapter 11 Tree Balance and Rotation Section 11.1 Algorithm for Rotation BTNode root = left right = data = 10 BTNode = left right = data = 20 BTNode NULL = left right = NULL
More informationCMSC th Lecture: Graph Theory: Trees.
CMSC 27100 26th Lecture: Graph Theory: Trees. Lecturer: Janos Simon December 2, 2018 1 Trees Definition 1. A tree is an acyclic connected graph. Trees have many nice properties. Theorem 2. The following
More informationLecture 5 February 26, 2007
6.851: Advanced Data Structures Spring 2007 Prof. Erik Demaine Lecture 5 February 26, 2007 Scribe: Katherine Lai 1 Overview In the last lecture we discussed the link-cut tree: a dynamic tree that achieves
More informationLecture 10. Elementary Graph Algorithm Minimum Spanning Trees
Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo
More informationHomework Assignment #3 Graph
CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 Graph Some of the problems are adapted from problems in the book Introduction to Algorithms by Cormen, Leiserson and Rivest, and some are
More information1. Represent each of these relations on {1, 2, 3} with a matrix (with the elements of this set listed in increasing order).
Exercises Exercises 1. Represent each of these relations on {1, 2, 3} with a matrix (with the elements of this set listed in increasing order). a) {(1, 1), (1, 2), (1, 3)} b) {(1, 2), (2, 1), (2, 2), (3,
More informationDisjoint Sets. The obvious data structure for disjoint sets looks like this.
CS61B Summer 2006 Instructor: Erin Korber Lecture 30: 15 Aug. Disjoint Sets Given a set of elements, it is often useful to break them up or partition them into a number of separate, nonoverlapping groups.
More informationComputer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Introduction and Overview
Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Introduction and Overview Welcome to Analysis of Algorithms! What is an Algorithm? A possible definition: a step-by-step
More informationComplexity Results on Graphs with Few Cliques
Discrete Mathematics and Theoretical Computer Science DMTCS vol. 9, 2007, 127 136 Complexity Results on Graphs with Few Cliques Bill Rosgen 1 and Lorna Stewart 2 1 Institute for Quantum Computing and School
More information1 Digraphs. Definition 1
1 Digraphs Definition 1 Adigraphordirected graphgisatriplecomprisedofavertex set V(G), edge set E(G), and a function assigning each edge an ordered pair of vertices (tail, head); these vertices together
More informationCHAPTER 3 FUZZY RELATION and COMPOSITION
CHAPTER 3 FUZZY RELATION and COMPOSITION The concept of fuzzy set as a generalization of crisp set has been introduced in the previous chapter. Relations between elements of crisp sets can be extended
More informationAn O(n 2.75 ) algorithm for online topological ordering 1
Electronic Notes in Discrete Mathematics 25 (2006) 7 12 www.elsevier.com/locate/endm An O(n 2.75 ) algorithm for online topological ordering 1 Deepak Ajwani a,2, Tobias Friedrich a and Ulrich Meyer a a
More informationDS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV
Sr.No. Question Option A Option B Option C Option D 1 2 3 4 5 6 Class : S.E.Comp Which one of the following is the example of non linear data structure Let A be an adjacency matrix of a graph G. The ij
More informationCHAPTER 3 FUZZY RELATION and COMPOSITION
CHAPTER 3 FUZZY RELATION and COMPOSITION Crisp relation! Definition (Product set) Let A and B be two non-empty sets, the prod uct set or Cartesian product A B is defined as follows, A B = {(a, b) a A,
More informationA Fast Algorithm for Optimal Alignment between Similar Ordered Trees
Fundamenta Informaticae 56 (2003) 105 120 105 IOS Press A Fast Algorithm for Optimal Alignment between Similar Ordered Trees Jesper Jansson Department of Computer Science Lund University, Box 118 SE-221
More informationRepresentations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs
Representations of Weighted Graphs (as Matrices) A B Algorithms and Data Structures: Minimum Spanning Trees 9.0 F 1.0 6.0 5.0 6.0 G 5.0 I H 3.0 1.0 C 5.0 E 1.0 D 28th Oct, 1st & 4th Nov, 2011 ADS: lects
More informationFast and Simple Algorithms for Weighted Perfect Matching
Fast and Simple Algorithms for Weighted Perfect Matching Mirjam Wattenhofer, Roger Wattenhofer {mirjam.wattenhofer,wattenhofer}@inf.ethz.ch, Department of Computer Science, ETH Zurich, Switzerland Abstract
More informationLATIN SQUARES AND THEIR APPLICATION TO THE FEASIBLE SET FOR ASSIGNMENT PROBLEMS
LATIN SQUARES AND THEIR APPLICATION TO THE FEASIBLE SET FOR ASSIGNMENT PROBLEMS TIMOTHY L. VIS Abstract. A significant problem in finite optimization is the assignment problem. In essence, the assignment
More informationGraph Algorithms: Chapters Part 1: Introductory graph concepts
UMass Lowell Computer Science 91.503 Algorithms Dr. Haim Levkowitz Fall, 2007 Graph Algorithms: Chapters 22-25 Part 1: Introductory graph concepts 1 91.404 Graph Review Elementary Graph Algorithms Minimum
More informationMath 778S Spectral Graph Theory Handout #2: Basic graph theory
Math 778S Spectral Graph Theory Handout #: Basic graph theory Graph theory was founded by the great Swiss mathematician Leonhard Euler (1707-178) after he solved the Königsberg Bridge problem: Is it possible
More informationCSE 100: GRAPH ALGORITHMS
CSE 100: GRAPH ALGORITHMS Dijkstra s Algorithm: Questions Initialize the graph: Give all vertices a dist of INFINITY, set all done flags to false Start at s; give s dist = 0 and set prev field to -1 Enqueue
More information1. Further Applications of Graph Traversal
1. Further Applications of Graph Traversal This is a replacement section, with the correct algorithm for strong components! In the following, assume G = (V, E) is a digraph with V = {1, 2,..., n}. Let
More informationOutline. Disjoint set data structure Applications Implementation
Disjoint Data Sets Outline Disjoint set data structure Applications Implementation Data Structures for Disjoint Sets A disjoint-set data structure is a collection of sets S = {S 1 S k }, such that S i
More informationCS 361 Data Structures & Algs Lecture 11. Prof. Tom Hayes University of New Mexico
CS 361 Data Structures & Algs Lecture 11 Prof. Tom Hayes University of New Mexico 09-28-2010 1 Last Time Priority Queues & Heaps Heapify (up and down) 1: Preserve shape of tree 2: Swaps restore heap order
More information