مرتضي صاحب الزماني 1 Basic Graph Algorithms. مرتضي صاحب الزماني 2 Graph Data Structures Adjacency Matrix [©Bazargan]

Slides:



Advertisements
Similar presentations
Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
Advertisements

IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
Graphs - II CS 2110, Spring Where did I leave that book?
1 Dijkstra’s Minimum-Path Algorithm Minimum Spanning Tree CSE Lectures 20 – Intro to Graphs.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Fundamentals of Python: From First Programs Through Data Structures
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
ITEC200 – Week 12 Graphs. 2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study.
Chapter 23 Minimum Spanning Trees
1 آزمايشگاه سيستم های هوشمند ( Domain-specific Architecture.
Chapter 9: Graphs Summary Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
ارائه روشي براي شناسايي کاراکترهاي دستنويس، برپايه شبکه LVQ.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
نام و نام خانوادگي : فريد ملازم 1 آزمايشکاه سيستم هاي هوشمند ( موضوع ارائه Process and Deployment Design.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Frank Carrano, © 2012.
L o g o Jieyi Long, Hai Zhou, and Seda Ogrenci Memik Dept. of EECS, Northwestern Univ. An O(nlogn) Edge-Based Algorithm for Obstacle- Avoiding Rectilinear.
مرتضي صاحب الزماني Memory Modeling. مرتضي صاحب الزماني مدل ساده package body Mem_Pkg is constant DataWidth_c : Natural := 8; constant AddrWidth_c : Natural.
Shortest Path Algorithms. Kruskal’s Algorithm We construct a set of edges A satisfying the following invariant:  A is a subset of some MST We start with.
Minimum Spanning Trees
Week -7-8 Topic - Graph Algorithms CSE – 5311 Prepared by:- Sushruth Puttaswamy Lekhendro Lisham.
Chapter 2 Graph Algorithms.
COSC 2007 Data Structures II Chapter 14 Graphs III.
Partitioning. 1 st homework:  Deadline: 13 Esfand 2.
مرتضي صاحب الزماني 1 Data Structures. مرتضي صاحب الزماني 2 Corner Stitching.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Minimal Spanning Tree Problems in What is a minimal spanning tree An MST is a tree (set of edges) that connects all nodes in a graph, using.
CS223 Advanced Data Structures and Algorithms 1 Review for Final Neil Tang 04/27/2010.
Minimum Spanning Trees CS 146 Prof. Sin-Min Lee Regina Wang.
Runtime O(VE), for +/- edges, Detects existence of neg. loops
Solving problems by searching Chapter 3 Modified by Vali Derhami.
1/34 Informed search algorithms Chapter 4 Modified by Vali Derhami.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Routing Topology Algorithms Mustafa Ozdal 1. Introduction How to connect nets with multiple terminals? Net topologies needed before point-to-point routing.
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
1/27 Informed search algorithms Chapter 4 Modified by Vali Derhami.
Solving problems by searching Chapter 3, part 2 Modified by Vali Derhami.
Department of Computer Eng. & IT Amirkabir University of Technology (Tehran Polytechnic) Data Structures Lecturer: Abbas Sarraf Order.
Graph Searching CSIT 402 Data Structures II. 2 Graph Searching Methodology Depth-First Search (DFS) Depth-First Search (DFS) ›Searches down one path as.
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
1 مرتضي صاحب الزماني Partitioning. 2 First Project Synthesis by Design Compiler Physical design by SoC Encounter –Use tutorials in \\fileserver\common\szamani\EDA.
Main Index Contents 11 Main Index Contents Graph Categories Graph Categories Example of Digraph Example of Digraph Connectedness of Digraph Connectedness.
گراف وحيدي پور. تعاريف مجموعه اي غير تهي از راس مجموعه اي از زوج راسها كه بوسيله يال بهمديگر متصل هستند. a b d e.
مرتضي صاحب الزماني 1 Maze Routing. Homework 4 مهلت تحویل : 23 اردیبهشت پروژه 1 : انتخاب طرح : امروز مرتضي صاحب الزماني 2.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
سيستم خبره مرکب ( ترکيب پيشرو و پسرو ) زماني که يک فرضيه احتمالي براي جواب داشته باشيم، روش backward مي تواند خيلي کاراتر و مناسبتر باشد. اگر هيچ احتمال.
Graphs. What is a graph? In simple words, A graph is a set of vertices and edges which connect them. A node (or vertex) is a discrete position in the.
Minimum Spanning Trees
COMP 6/4030 ALGORITHMS Prim’s Theorem 10/26/2000.
Graph Algorithm.
نمايش اعداد در کامپيوتر چهار عمل اصلي
Minimum Spanning Trees
Graph Algorithm.
هیدرولیک جریان در کانالهای باز
با تشکر از دکتر جواد سلیمی
Chapter 11 Graphs.
CSCI2100 Data Structures Tutorial
Concurrent Statements
Prim’s algorithm for minimum spanning trees
Graph Algorithm.
Review for Final Neil Tang 05/01/2008
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

مرتضي صاحب الزماني 1 Basic Graph Algorithms

مرتضي صاحب الزماني 2 Graph Data Structures Adjacency Matrix [©Bazargan]

مرتضي صاحب الزماني 3 Graph Data Structures Adjacency Matrix [©Bazargan]

مرتضي صاحب الزماني 4 Graph Data Structures Adjacency List [©Bazargan]

مرتضي صاحب الزماني 5 Graph Data Structures Adjacency List [©Bazargan]

مرتضي صاحب الزماني 6 Graph Search Algorithms [©Bazargan]

مرتضي صاحب الزماني 7 Graph Search Algorithms Graph BFS DFS [©Bazargan]

مرتضي صاحب الزماني 8 Depth-First Search پيچيدگي زماني : O (|V| + |E|) چون همة گره ها و يالها حداکثر يک بار پيموده مي شوند.

مرتضي صاحب الزماني 9 Breadth-First Search پيچيدگي زماني : O (|V| + |E|). باشروع از يک گره، همة گره هاي قابل دسترسي را در يک صف قرار مي دهد و آنها را ملاقات مي کند. اگر گرهي قبلاً ملاقات شده است در صف قرار نمي گيرد. تکرار براي هر گره در صف. تفاوت با DFS: صف به جاي پشته.

مرتضي صاحب الزماني 10 Topological Search براي گراف جهت دار بدون سيکل (DAG). ترتيب Topological: يعني parent ها هميشه قبل از اولاد ملاقات مي شوند. مي تواند به صورت BFS جستجو شود. CA B D E C-A-E-B-D

مرتضي صاحب الزماني 11 Spanning Tree G’ or E’  E بسياري از مسائل گراف به صورت کلي زيرند : [©Bazargan]

مرتضي صاحب الزماني 12 Minimum Spanning Tree (MST) Formal Definition [©Bazargan]

مرتضي صاحب الزماني 13 Minimum Spanning Tree

مرتضي صاحب الزماني 14 Kruskal MST Algorithm [©Bazargan]

مرتضي صاحب الزماني 15 Kruskal MST Algorithm Kruskal’s algorithm is O(m log m) (m=|E|)

Kruskal MST Algorithm E(1): the set of the sides of the minimum genetic tree. E(2): the set of the remaining sides. STEPS E(1)=0,E(2)=E While E(1) contains less then n-1 sides and E(2)=0 do From the sides of E(2) choose one with minimum cost-->e(ij) E(2)=E(2)-{e(ij) } If V(i),V(j) do not belong in the same tree then unite the trees of V(i) and V(j) to one tree. end (If) ) contains less then n-1 sides and E(2)=0 do end (While) End مرتضي صاحب الزماني 16

مرتضي صاحب الزماني 17 Shortest Path Used in VLSI routing. Single-Pair Shortest Path (SPSP):

مرتضي صاحب الزماني 18 Single-Pair Shortest Path در يک گراف وزن دار، براي دو گره u, v  V ، مجموعه گره هاي P  V ( شامل u و v) را طوري انتخاب کنيد که P حداقل هزينه را در G از u به v بدهد.

مرتضي صاحب الزماني 19 Dijkstra Algorithm کوتاهترين مسير از يک گره به همة گره هاي ديگر را پيدا مي کند. O(n 2 ) Initialize D Find min distance from u to each node (so far) Find shortest path by backtracing

مرتضي صاحب الزماني 20 All-Pairs Shortest Path کوتاهترين مسير بين همة زوج گره ها.

مرتضي صاحب الزماني 21 Matching در يک گراف بدون جهت G = (V, E) ، E’  E را طوري پيدا کنيد که براي همة گره هاي v حداکثر يک يال از E’ مجاور v باشد. G CA B D E F H Maximum matching: matching ي با ماکزيمم تعداد ( وزن ) يالها. CA B D E F H

مرتضي صاحب الزماني 22 Min-Cut

مرتضي صاحب الزماني 23 Steiner Minimum Tree (SMT)

مرتضي صاحب الزماني 24 Steiner Minimum Tree 8

مرتضي صاحب الزماني 25 Steiner Minimum Tree When D = V, SMT = MST. When |D| = 2, SMT = Single Pair Shortest Path Problem. The SMT problem is NP-Complete.

مرتضي صاحب الزماني 26 Rectilinear Steiner Tree (RST) A steiner tree whose edges are constrained to be vertical or horizontal. Steiner point Demand point

مرتضي صاحب الزماني 27 Rectilinear Steiner Minimum Tree (RSMT) Similar to the SMT problem, except that the tree T is a minimum cost rectilinear Steiner tree. This problem is NP-Complete but we can get an approximated solution to this problem by making use of the MST.

مرتضي صاحب الزماني 28 Underlying Grid Graph

مرتضي صاحب الزماني 29 Approximate Solution to RSMT Construct a MST T. Obtain a RST T’ from T by connecting the vertices in T using vertical and horizontal edges. MST or a better one There can be many solutions.

مرتضي صاحب الزماني 30 Different Steiner Trees

مرتضي صاحب الزماني 31 Approximate Solution to RSMT It is proved that: W MST  1.5 W RSMT RSMT ي که از MST به دست مي آيد RSMT واقعي ( بهينه )

مرتضي صاحب الزماني 32 Line Sweep Algorithm

مرتضي صاحب الزماني 33 Line Sweep Algorithm CFCFF

مرتضي صاحب الزماني 34 Line Sweep Algorithm

مرتضي صاحب الزماني 35 Line Sweep Algorithm (Hidden)

مرتضي صاحب الزماني 36 Line Sweep Algorithm (Hidden) Time Complexity: O(nlogn): sorting 2n points. O(logn): INSERT. DELETE, ABOVE, BELOW (sorted list = a balanced tree) loop iteration: 2n times  O(nlogn) + O(2n * logn) = O(nlogn)

مرتضي صاحب الزماني 37 يک مرجع الکترونيکي Algorithms and Complexity, Wilf: