...Task Background: Graphs and trees are useful in visualizing data and the relations within and between data sets. Conversely, it is also important to be able to represent graphs as databases or arrays, so that programs for processing the data can be written. Part I: Adjacency Matrix and Shortest Path Construct a graph based on the adjacency matrix that appears below. Label all nodes with indices consistent with the placement of numbers within the matrix. ⌈0 | 6 | 0 | 5 | 0⌉ | | 6 | 0 | 1 | 0 | 3 | | | 0 | 1 | 0 | 4 | 8 | | | 5 | 0 | 4 | 0 | 0 | | ⌊0 | 3 | 8 | 0 | 0⌋ | | | | | | * Describe the graph and why it is consistent with the matrix. The Graph above is an undirected graph. As the lines are not directed towards a particular node, the lines or edges go both ways. It is consistent with the matrix because the matrix is defining the edges. * How many simple paths are there from vertex 1 to vertex 5? Explain. There are 3 paths. 1-2-5, 1-2-3-5, 1-4-3-5. * Which is the shortest of those paths? That would be the 1-2 path. As the sum equals 9 and is the shortest path. 1-2-3-5=15 and 1-4-3-5=17 Part II: Trees * Construct and describe a tree that indicates the following: * A college president has 2 employees who answer directly to him or her, namely a vice president and provost. * The vice president and provost each have an administrative assistant. * Three deans answer to the provost, and the heads of finance and alumni relations...
Words: 396 - Pages: 2
...Algorithmic BFS, DFS, Kruskal, Prim’s, Adjacency matrix, Adjacency List Table of Contents Analysis of the Problem 4 Graph Searching 4 BFS: 4 DFS 4 Comparison of Algorithms 5 Features of BFS and DFS Algorithms 5 Minimum Spanning Tree 6 Prim’s Algorithm: 6 Kruskal’s Algorithm: 6 Feature of Prim’s and Kruskal’s Algorithm 7 Application 7 Shortest Path Problem 7 Shortest Path Algorithms 7 Adjacency Matrix:- 8 Adjacency List:- 9 Unweighted and Undirected Breadth First Search (BFS) 10 Pseudo Code for Breadth First Search (BFS) 21 Analysis Complexity of BFS 21 Depth First Search (DFS) 22 Algorithm for DFS 31 Analysis Complexity of DFS 31 DIKSTRA’S SINGLE SOURCE SHORTEST PATH 32 Algorithm for Dijkstra 39 Analysis 39 How Dijkstra’s Efficiency could be improved? 40 Kruskal’s Algorithm 41 Algorithm for Krushkal Algorithm 51 Analysis Complexity of Kruskal’s Algorithm 51 Prim’s Algorithm 52 Pseudo Code for Prims Algorithm 61 Analysis 61 Comparison of Time complexities with their analysis 62 Adjacency List and Adjacency Matrix 62 Description and Justification of chosen class 62 Definition of classes 63 Assumptions 64 Assumption of BFS: 64 Assumption of Prim’s 64 Assumption of Kruskal’s 64 References and Citations 65 Books: 65 Websites 65 Analysis of the Problem There are various data structures are used to represent graphs in computer memory such as adjacency list, incidence list, adjacency matrix, incidence matrix. Different algorithms are applied...
Words: 8195 - Pages: 33
...logical structure 物理结构 phyical structure 线性结构 linear structure 非线性结构 nonlinear structure 基本数据类型 atomic data type 固定聚合数据类型 fixed-aggregate data type 可变聚合数据类型 variable-aggregate data type 线性表 linear list 栈 stack 队列 queue 串 string 数组 array 树 tree 图 grabh 查找,线索 searching 更新 updating 排序(分类) sorting 插入 insertion 删除 deletion 前趋 predecessor 后继 successor 直接前趋 immediate predecessor 直接后继 immediate successor 双端列表 deque(double-ended queue) 循环队列 cirular queue 指针 pointer 先进先出表(队列) first-in first-out list 后进先出表(队列) last-in first-out list 栈底 bottom 栈定 top 压入 push 弹出 pop 队头 front 队尾 rear 上溢 overflow 下溢 underflow 数组 array 矩阵 matrix 多维数组 multi-dimentional array 以行为主的顺序分配 row major order 以列为主的顺序分配 column major order 三角矩阵 truangular matrix 对称矩阵 symmetric matrix 稀疏矩阵 sparse matrix 转置矩阵 transposed matrix 链表 linked list 线性链表 linear linked list 单链表 single linked list 多重链表 multilinked list 循环链表 circular linked list 双向链表 doubly linked list 十字链表 orthogonal list 广义表 generalized list 链 link 指针域 pointer field 链域 link field 头结点 head node 头指针 head pointer 尾指针 tail pointer 串 string 空白(空格)串 blank string 空串(零串) null string 子串 substring 树 tree 子树 subtree 森林 forest 根 root 叶子 leaf 结点 node 深度 depth 层次 level 双亲 parents 孩子 children 兄弟 brother 祖先 ancestor 子孙 descentdant 二叉树 binary tree 平衡二叉树 banlanced binary tree 满二叉树 full binary tree 完全二叉树 complete binary tree 遍历二叉树 traversing binary tree 二叉排序树 binary sort tree 二叉查找树 binary...
Words: 1522 - Pages: 7
...representations of a graph 1. Adjacency Matrix-used for dense graphs (V2 memory space) a. Aij=1 if edge exists between I and J but 0 if not 2. Adjacency List- Used for sparse graphs (V+E memory space or V+2E for undirected) b. Array adj of |V| lists, one for each vertex. c. Adj[u] contains all vertices adjacent (or reachable by one edge) to u Breadth First Search(G,s) BFS.G; s/ 1 for each vertex u in G.V –{s} 2 u.color = WHITE 3 u.disc =∞ 4 u.parent= NIL 5 s.color = GRAY 6 s.disc = 0 7 s.parent= NIL 8 Q = ∅; 9 ENQUEUE(Q,s) 10 while Q ≠ ∅ 11 u = DEQUEUE(Q) 12 for each v in G.Adj[u] 13 if v.color == WHITE 14 v.color = GRAY 15 v.disc = u.disc + 1 16 v.parent = u 17 ENQUEUE(Q,v) 18 u.color = BLACK White means not discovered yet, grey mean discovered but not finished, black means finished. Run time O(V+E) BFS gives shortest path from s to every vertex Lemma: x in Li and Y in Lj and edge (x,y) exists Then |i-j| less than or equal to 1 Depth First search Properties: 1) v is a descendenant of u iff v if discovered when u is gray 2) Parenthesis theorem, u and v in V. either discovery and finish times are disjoint (u nor v are descendents of each other) or one is discovered after and finished before the other (u is a descendent of v or vice versa) White path theorem In a depth-first forest, vertex v is a descendant of u if and only if at the u is discovered there is a path from u to v consisting entirely...
Words: 5019 - Pages: 21
...CPS 230 DESIGN AND ANALYSIS OF ALGORITHMS Fall 2008 Instructor: Herbert Edelsbrunner Teaching Assistant: Zhiqiang Gu CPS 230 Fall Semester of 2008 Table of Contents 1 I 2 3 4 5 Introduction D ESIGN T ECHNIQUES Divide-and-Conquer Prune-and-Search Dynamic Programming Greedy Algorithms First Homework Assignment S EARCHING 3 4 5 8 11 14 17 18 19 22 26 29 33 34 35 38 41 44 IV 13 14 15 16 G RAPH A LGORITHMS Graph Search Shortest Paths Minimum Spanning Trees Union-Find Fourth Homework Assignment T OPOLOGICAL A LGORITHMS 17 18 19 Geometric Graphs Surfaces Homology Fifth Homework Assignment G EOMETRIC A LGORITHMS 20 21 22 Plane-Sweep Delaunay Triangulations Alpha Shapes Sixth Homework Assignment NP-C OMPLETENESS 23 24 25 Easy and Hard Problems NP-Complete Problems Approximation Algorithms Seventh Homework Assignment 45 46 50 53 56 60 61 62 65 68 72 73 74 77 81 84 85 86 89 92 95 V II 6 7 8 9 Binary Search Trees Red-Black Trees Amortized Analysis Splay Trees Second Homework Assignment P RIORITIZING VI III 10 11 12 Heaps and Heapsort Fibonacci Heaps Solving Recurrence Relations Third Homework Assignment VII 2 1 Introduction Meetings. We meet twice a week, on Tuesdays and Thursdays, from 1:15 to 2:30pm, in room D106 LSRC. Communication. The course material will be delivered in the two weekly lectures. A written record of the lectures will be available on the web, usually a day after the lecture. The web also contains other information...
Words: 49158 - Pages: 197
...problems 3, 6, 8, 11, 15, & 16 · Ch. 11 of Discrete and Combinatorial Mathematics o Exercise 11.2, problems 1, 6, 12, & 13, o Exercise 11.3, problems 5, 20, 21, & 22 o Exercise 11.4, problems 14, 17, & 24 o Exercise 11.5, problems 4 & 7 o Exercise 11.6, problems 9 &10 · Ch. 12 of Discrete and Combinatorial Mathematics o Exercise 12.1, problems 2, 6, 7, & 11 o Exercise 12.2, problems 6 & 9 o Exercise 12.3, problems 2 & 3 * Exercise 12.5, problems 3 & 8 Section 11.1 3). For the graph in Fig. 11.7, how many paths are there from b to f ? 1). b a c d e g f 2). b a c d e f 3). b c d e g f 4). b c d e f 5). b e g f 6). b e f This would = 6 ways. 6). If a, b are distinct vertices in a connected undirected graph G, the distance from a to b is defined to be the length of a shortest path from a to b (when a = b the distance is defined to be 0). For the graph in Fig. 11.9, find the distances from d to (each of) the other vertices in G. d to e = 1 d to f = 1 d to c = 1 d to k = 2 d to g = 2 d to h = 3 d to j = 3 d to l = 3 d to m = 3 d to i = 4 Section 11.2 1). Let G be the undirected graph in Fig. 11.27(a). a) How many connected subgraphs of G have four vertices and include a cycle? 3 b) Describe the subgraph G1 (of G) in part (b) of the figure first, as an induced subgraph and second, in terms of deleting a vertex of G. G1 = (U) where U = {a, b, d, f, g, h, I, j}; G1...
Words: 1310 - Pages: 6
...Chapter 11: Sec 11.1 /3 Sec 11.1 /6 6. If a, b are distinct vertices in a connected undirected graph G, the distance from a to b is defined to be the length of a shortest path from a to b (when a =b the distance is defined to be 0). For the graph in Fig. 11.9, find the distances from d to (each of) the other vertices in G. Sec 11.1 /8 Figure 11.10 shows an undirected graph representing a section of a department store. The vertices indicate where cashiers are located; the edges denote unblocked aisles between cashiers. The department store wants to set up a security system where (plainclothes) guards are placed at certain cashier locations so that each cashier either has a guard at his or her location or is only one aisle away from a cashier who has a guard. What is the smallest number of guards needed? a b c Sec 11.1 /11 10. Give an example of a connected graph G where removing any edge of G results in a disconnected graph. 11. Let G be a graph that satisfies the condition in Exercise 10. (a) Must G be loop-free? (b) Could G be a multigraph? (c) If G has n vertices, can we determine how many edges it has? Sec 11.1 /15 15. For the undirected graph in Fig. 11.12, find and solve a recurrence relation for the number of closed v-v walks of length n ≥ 1, if we allow such a walk, in this case, to contain or consist of one or more loops. Sec 11.1 /16 16. Unit-Interval Graphs. For n ≥ 1, we start with n closed intervals of unit length...
Words: 1858 - Pages: 8
...2. A club has 25 members. A.) a) How many ways are there to choose four members of the club to serve on an executive committee? 12650 B.) b) How many ways are there to choose a president, vice president, secretary, and treasurer of the club, where no person can hold more than one office? 303600 4. In how many different ways can five elements be selected in order from a set with three elements when repetition is allowed? 243 5. What is the probability that a fair die never comes up an even number when it is rolled six times? 0.016+- 0.001 (Note: Enter the value of probability in decimal format and round it to three decimal places.) 6. Let p and q be the propositions p: You have the flu. q: You miss the final examination. Identify an English translation that expresses the compound proposition p → q. * If you miss the final exam then you have the flu. * If you have the flu, then you miss the final exam. * If you have the flu, then you will not miss the final exam. * If you don't have the flu, then you miss the final exam. 7. Let q and r be the propositions q: You miss the final examination. r: You pass the course. An English translation of the compound proposition ¬q ↔ r is "You do not miss the final exam if and only if you pass the course." * Yes * No 8. Let q and r be the propositions q: You miss the final examination. r: You pass the course. An English translation of the compound proposition q → ¬r is "If you miss the final exam, then you pass the course...
Words: 3659 - Pages: 15
...Mathematics HL First examinations 2008 b DIPLOMA PROGRAMME MATHEMATICS HL First examinations 2008 International Baccalaureate Organization Buenos Aires Cardiff Geneva New York Singapore Diploma Programme Mathematics HL First published in September 2006 International Baccalaureate Organization Peterson House, Malthouse Avenue, Cardiff Gate Cardiff, Wales GB CF23 8GL United Kingdom Phone: + 44 29 2054 7777 Fax: + 44 29 2054 7778 Web site: www.ibo.org c International Baccalaureate Organization 2006 The International Baccalaureate Organization (IBO) was established in 1968 and is a non-profit, international educational foundation registered in Switzerland. The IBO is grateful for permission to reproduce and/or translate any copyright material used in this publication. Acknowledgments are included, where appropriate, and, if notified, the IBO will be pleased to rectify any errors or omissions at the earliest opportunity. IBO merchandise and publications in its official and working languages can be purchased through the IB store at http://store.ibo.org. General ordering queries should be directed to the sales and marketing department in Cardiff. Phone: +44 29 2054 7746 Fax: +44 29 2054 7779 E-mail: sales@ibo.org Printed in the United Kingdom by Antony Rowe Ltd, Chippenham, Wiltshire. 5007 CONTENTS INTRODUCTION 1 NATURE OF THE SUBJECT 3 AIMS 6 OBJECTIVES 7 SYLLABUS OUTLINE 8 SYLLABUS DETAILS 9 ASSESSMENT OUTLINE 53 ASSESSMENT DETAILS ...
Words: 17566 - Pages: 71
...depends on the locations of the other departments. Dr. Erkan Bayraktar 2 11.07.2010 ... Mathematical Formulation 11.07.2010 Dr. Erkan Bayraktar 3 Quadratic Assignment Problem Optimal solution procedures are difficult to solve for realistic size problems. Therefore, two types of heuristic procedures are considered. Construction Procedure Improvement Procedures 11.07.2010 Dr. Erkan Bayraktar 4 Evaluation of Facility Designs Which layout is best? Is layout A better than Layout B? Several Common Methods for Block Layouts Distance Based Scoring Requires flow and distance Requires subjective AEIOU relationships Many methods available Weighted factor scoring Adjacency Based Scoring Multi-Objective Scoring 11.07.2010 Dr. Erkan Bayraktar 5 Distance Based Scoring Volume-Distance product Distance usually measured rectilinearly, between centroids Assumes that the material flow system has already been specified Assumes that the variable flow cost is proportional to distance Distance often depends on the aisle layout and material handling equipment Can also add a cost term ($/dx) to convert to $ 11.07.2010 Dr. Erkan Bayraktar 6 How should you measure distance? Most common is “rectilinear” distance between centroids d(X, P) = |x - a| + |y - b| Absolute difference in x direction PLUS absolute difference in...
Words: 16812 - Pages: 68
...PART III GRAPH THEORY 224 13 Food Webs Author: College. Robert A. McGuigan, Department of Mathematics, Westfield State Prerequisites: The prerequisites for this chapter are basic concepts of graph theory. See Sections 9.1 and 9.2 of Discrete Mathematics and Its Applications. Introduction A food web is a directed graph modeling the predator-prey relationship in an ecological community. We will use this directed graph to study the question of the minimum number of parameters needed to describe ecological competition. For this purpose we will consider how graphs can be represented as intersection graphs of families of sets. We will also investigate the axiomatic description of measures of status in food webs. Competition In an ecological system, the various species of plants and animals occupy niches defined by the availability of resources. The resources might be defined in terms of factors such as temperature, moisture, degree of acidity, amounts of nutrients, 225 226 Applications of Discrete Mathematics and so on. These factors are subject to constraints such as temperature lying in a certain range, pH lying within certain limits, etc. The combination of all these constraints for a species then defines a region in n-dimensional Euclidean space, where n is the number of factors. We can call this region the ecological niche of the species in question. For example, suppose we restrict ourselves to three factors, such as temperature...
Words: 4994 - Pages: 20
...Digital Image Processing Second Edition Rafael C. Gonzalez University of Tennessee Richard E. Woods MedData Interactive Prentice Hall Upper Saddle River, New Jersey 07458 Library of Congress Cataloging-in-Pubblication Data Gonzalez, Rafael C. Digital Image Processing / Richard E. Woods p. cm. Includes bibliographical references ISBN 0-201-18075-8 1. Digital Imaging. 2. Digital Techniques. I. Title. TA1632.G66 621.3—dc21 2001 2001035846 CIP Vice-President and Editorial Director, ECS: Marcia J. Horton Publisher: Tom Robbins Associate Editor: Alice Dworkin Editorial Assistant: Jody McDonnell Vice President and Director of Production and Manufacturing, ESM: David W. Riccardi Executive Managing Editor: Vince O’Brien Managing Editor: David A. George Production Editor: Rose Kernan Composition: Prepare, Inc. Director of Creative Services: Paul Belfanti Creative Director: Carole Anson Art Director and Cover Designer: Heather Scott Art Editor: Greg Dulles Manufacturing Manager: Trudy Pisciotti Manufacturing Buyer: Lisa McDowell Senior Marketing Manager: Jennie Burger © 2002 by Prentice-Hall, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness...
Words: 66542 - Pages: 267
...INVITED PAPER Overlapping Communities Explain Core–Periphery Organization of Networks The paper presents a new paradigm for uncovering the modular structure of complex networks. By Jaewon Yang and Jure Leskovec ABSTRACT | Networks provide a powerful way to study food web networks have a single central dominant core while complex systems of interacting objects. Detecting network communities in protein–protein interaction (PPI) as well as communitiesVgroups of objects that often correspond to func- product copurchasing networks have small overlaps and form tional modulesVis crucial to understanding social, technolog- many local cores. ical, and biological systems. Revealing communities allows for | Community detection; core–periphery structure; analysis of system properties that are invisible when consid- KEYWORDS ering only individual objects or the entire system, such as the identification of module boundaries and relationships or the ground-truth communities; networks classification of objects according to their functional roles. However, in networks where objects can simultaneously belong to multiple modules at once, the decomposition of a network into overlapping communities remains a challenge. Here we present a new paradigm for uncovering the modular structure of complex networks, based on a decomposition of a network into any combination of overlapping, nonoverlapping, and hierarchically organized communities...
Words: 7671 - Pages: 31
...EIGRP and OSPF Comparison For Client Sponsor Prepared By Scott Hogg Project Number 02 Date March 14, 2002 |Distribution List | |Name |Title/Duties |Company | |John Vogt-Nilsen |Manager – Network Operations | | |Sammy Hutton |Principal Systems Analyst | | |Scott Hogg |Principal Consultant |Lucent | |Phil Colon |Managing Consultant |Lucent | |Revision History | |Version |Date |Author |Comments | |1.0 |03/14/2002 |Scott Hogg |Initial Draft | | | | | | |...
Words: 8531 - Pages: 35
...i Computational Complexity: A Modern Approach Draft of a book: Dated January 2007 Comments welcome! Sanjeev Arora and Boaz Barak Princeton University complexitybook@gmail.com Not to be reproduced or distributed without the authors’ permission This is an Internet draft. Some chapters are more finished than others. References and attributions are very preliminary and we apologize in advance for any omissions (but hope you will nevertheless point them out to us). Please send us bugs, typos, missing references or general comments to complexitybook@gmail.com — Thank You!! DRAFT ii DRAFT About this book Computational complexity theory has developed rapidly in the past three decades. The list of surprising and fundamental results proved since 1990 alone could fill a book: these include new probabilistic definitions of classical complexity classes (IP = PSPACE and the PCP Theorems) and their implications for the field of approximation algorithms; Shor’s algorithm to factor integers using a quantum computer; an understanding of why current approaches to the famous P versus NP will not be successful; a theory of derandomization and pseudorandomness based upon computational hardness; and beautiful constructions of pseudorandom objects such as extractors and expanders. This book aims to describe such recent achievements of complexity theory in the context of the classical results. It is intended to both serve as a textbook as a reference for self-study. This means...
Words: 210134 - Pages: 841