An Early Problem in Graph Theory. Clicker Question 1. Konigsberg and the River Pregel
|
|
- Ashley Knight
- 5 years ago
- Views:
Transcription
1 raphs Topic " Hopefully, you've played around a bit with The Oracle of acon at Virginia and discovered how few steps are necessary to link just about anybody who has ever been in a movie to Kevin acon, but could there be some actor or actress who is even closer to the center of the Hollywood universe?. y processing all of the almost half of a million people in the Internet Movie atabase I discovered that there are currently 0 people who are better numbers we see that the average (Sean) onnery Number is about.8 making onnery a better center than acon" -Who is the enter of the Hollywood Universe?, University of Virginia n arly Problem in raph Theory Leonhard uler (0-8) One of the first mathematicians to study graphs The Seven ridges of Konigsberg Problem Konigsberg now called Kaliningrad puzzle for the residents of the city The river Pregel flows through the city bridges cross the river an you cross all bridges while crossing That was in 00. In 0 Harvey Keitel has become the center of the Hollywood Universe. onnery is th. each bridge only once? acon has moved up to 0 th. S raphs Konigsberg and the River Pregel licker Question How many solutions does the Seven ridges of Konigsberg Problem have? >= S raphs S raphs
2 rute orce? uler's Solution How to Solve Redraw the map as a graph (really a multigraph) a b c d uler's Proposal connected graph has an uler tour (possible to cross each edge only once while traversing each edge only once and returning to ing point) if and only if every vertex has an even number of edges ulerian ircuit What if we reduce the problem to only crossing each edge (bridge) exactly once? oesn't matter if we end up where we ed ulerian Trail S raphs 5 S raphs raph efinitions graph is comprised of a set of vertices (nodes) and a set of edges (links, arcs) connecting the vertices in a directed graph edges are one-way movement allowed from first node to second, but not second to first directed graphs also called digraphs in an undirected graph edges are two-way movement allowed in either direction efinitions In a weighted graph the edge has cost or weight that measures the cost of traveling along the edge path is a sequence of vertices connected by edges The path length is the number of edges The weighted path length is the sum of the cost of the edges in a path cycle is a path of length or more that s and ends at the same vertex a directed acyclic graph is a directed graph with no cycles S raphs S raphs 8
3 raphs We've Seen link link link link 9 xample raph omputer Scientists use graphs to model all kinds of things 5 5 link link link rpanet 99, 9 S raphs 9 S raphs 0 Roman Land Transportation Network xample raph Roman Land Transportation Network S raphs S raphs
4 xample raph xample raph nron s 00 US irport Network S raphs S raphs xample raph xample raph S raphs 5 "Jefferson" High School, Ohio hains of ffection: The Structure of dolescent Romantic and S Sexual Networks, 005, raphs
5 Representing raphs How to store a graph as a data structure? djacency Matrix Representation ountry rgentina razil olivia hile olumbia cuador rench uiana uyana Paraguay Peru Suriname Uruguay Venezuela ode r l h o Pa Pe S U V S raphs S raphs 8 The Map oloring Problem How many colors do you need to color a map, so that no countries that have a common border (not a point) are colored the same? How to solve using rute orce? reen Solution Yellow lue lue Yellow Red reen lue Yellow reen lue Yellow S raphs 9 S raphs 0
6 What bout the Ocean? Make the Ocean lue Red Yellow Yellow Red reen Red reen Yellow lue lue reen Red Yellow lue S raphs S raphs More efinitions dense graph is one with a large number of edges maximum number of edges? sparse graph is one in which the number of edges is much less than the maximum possible number of edges No standard cutoff for dense and sparse graphs S raphs raph Representation or dense graphs the adjacency matrix is a reasonable choice or weighted graphs change booleans to cost an the adjacency matrix handle directed graphs? Most graphs are sparse, not dense or sparse graphs an adjacency list is an alternative that uses less space ach vertex keeps a list of vertices it is connected to. S raphs
7 raph Implementation raph lass This raph class stores vertices ach vertex has an adjacency list what vertices does it connect to? shortest path method finds all paths from vertex to every other vertex in graph after shortest path method called queries can be made for path length from node to destination node S raphs Vertex lass (nested in raph) dge lass (nested in raph) S raphs S raphs 8
8 V Unweighted Shortest Path iven a vertex, S (for ) find the shortest path from S to all other vertices in the graph raph is unweighted (set all edge costs to ) V S V V V 8 V Word Ladders gree upon dictionary Start word and end word of same length hange one letter at a time to form step Step must also be a word xample: Start = silly, end = funny V S raphs 9 V 5 S raphs 0 raph Representation What are the vertices and when does an edge exist between two vertices? Vertices dges. Letters Words. Words Words that share one or more letters. Letters Words that share one or more letters. Words Words that differ by one letter. Words Letters Portion of raph S raphs S raphs
9 Size of raph Number of vertices and edges depends on dictionary Modified Scrabble dictionary, 5 letter words Words are vertices 80 words dge exists between word if they are one letter different,9 edges Is this graph sparse or dense?. Sparse. ense Max number of edges = N * (N - ) /,9,0 S raphs Unweighted Shortest Path lgorithm Problem: ind the shortest word ladder between two words if one exists What kind of search should we use?. readth irst Search. epth irst Search. ither one S raphs Unweighted Shortest Path lgorithm Set distance of to itself to 0 reate a queue and add the vertex while the queue is not empty remove front loop through all edges of current vertex get node edge connects to if this node has not been visited sets its distance to current distance + sets its previous node to current node add new node to queue Portion of raph S raphs 5 S raphs
10 Start at "" and enqueue it [] S raphs equeue (), loop through edges [] S raphs 8 equeue (), loop through edges [, ] S raphs 9 equeue (), loop through edges [,, ] S raphs 0
11 equeue (), loop through edges [,,, ] S raphs equeue (), loop through edges [,,,, ] S raphs one with, dequeue () [,,, ] S raphs loop through edges of ( already present) [,,, ] S raphs
12 swarm loop through edges of ( already present) [,,, ] S raphs 5 loop through edges of [,,,, swarm] S raphs loop through edges of [,,,, swarm, sware] sware swarm Unweighted Shortest Path Implement method demo how is path printed? The diameter of a graph is the longest shortest past in the graph How to find? How to find center of graph? vertex connected to the largest number of other vertices with the shortest average path length S raphs S raphs 8
13 Positive Weighted Shortest Path dges in graph are weighted and all weights are positive Similar solution to unweighted shortest path ijkstra's algorithhm dsger W. ijkstra (90 00) UT Professor lgorithm developed in 95 and published in 959. Vertex lass (nested in raph) S raphs 9 S raphs 50 ijkstra's lgorithm Pick the vertex Set the cost of the vertex to 0 and all other vertices to ININITY While there are unvisited vertices: Let the current vertex be the lowest cost vertex that has not yet been visited mark current vertex as visited for each edge from the current vertex if the sum of the cost of the current vertex and the cost of the edge is less than the cost of the destination vertex update the cost of the destination vertex set the previous of the destination vertex to the current vertex 5 ijkstra's lgorithm xample of a reedy lgorithm reedy lgorithm does what appears to be the best thing at each stage of solving a problem ives best solution in ijkstra's lgorithm oes NOT always lead to best answer air teams: (0, 0, 8, 8, 8), teams Making change with fewest coins (, 5, 0) 5 cents (, 5, ) 5 cents S raphs 5
14 5 What is the lowest cost path from to? is vertex 5 Set cost of to 0, all others to ININITY Place in a priority queue 5 5 [(,0)] pq dequeue (,0) Mark as visited 55 [ ] pq current vertex : loop through 's edges if sum of cost from to edge is less than current cost update cost and prev 5
15 5 5 [ ] pq ->, 0 + < ININITY [(,)] pq ->, 0 + < ININITY [(,)] pq [(,), (, )] pq [(,), (, )] pq ->, 0 + < ININITY [(,), (, ), (, )] pq current vertex : [(,), (, ), (, )] pq loop through 's edges if sum of cost from to edge is less than current cost 59 update cost and prev 0
16 5 5 [(, ), (, )] pq ->, + < update 's cost and previous [(, ), (, ), (, )] pq [(, ), (, ), (, )] pq ->, + < ININITY [(, ), (, ), (, ), (, )] pq 5 5 [(, ), (, ), (, ), (, )] pq [(, ), (, ), (, )] pq current vertex is, cost ->, already visited so skip loop through 's edges
17 5 [(, ), (, ), (, )] pq ->, already visited so skip [(, ), (, ), (, )] pq ->, + < ININITY [(, ), (, ), (, ), (, )] pq 5 5 [(, ), (, ), (, ), (, )] pq current vertex is lready visited so skip [(, ), (, ), (, )] pq current vertex is loop through 's edges 5 5 5
18 9 [(, ), (, )] pq ->, already visited so skip [(, ), (, )] pq ->, + < update 's cost and previous [(, ), (, ), (, )] pq [(, ), (, ), (, )] pq current vertex is loop through 's edges [(, ), (, )] pq ->, already visited so skip
19 [(, ), (, )] pq ->, + < ININITY update 's cost and previous [(, ), (, ), (, )] pq [ (, ), (, ), (, )] pq ->, already visited so skip [(, ), (, ), (, )] pq ->, + 5 < update 's cost and previous [(, ), (, ), (, ), (, )] pq [(, ), (, ), (, )] pq current vertex is loop though edges, already visited all neighbors
20 5 5 [(, ), (, )] pq current vertex is loop though edges, already visited all neighbors No unvisited vertices. ach Vertex stores cost (distance) of lowest cost path from Vertex to itself and previous vertex in path from vertex to itself. 8 Implementing ijkstra's reate a Path class to allow for multiple distances to a given vertex Use a priority queue of Paths to store the vertices and distances lternatives to ijkstra's lgorithm *, pronounced " Star" heuristic, goal of finding shortest weighted path from single vertex to goal vertex Uses actual distance like ijkstra's but also estimates remaining cost or distance distance is set to current distance from PLUS the estimated distance to the goal or example when finding a path between towns, estimate the remaining distance as the straight-line (as the crow files) distance between current location and goal. S raphs 9 S raphs 80
21 Spanning Tree Spanning Tree: tree of edges that connects all the vertices in a graph 5 Prim's lgorithm Pick a vertex arbitrarily from graph In other words, it doesn't matter which one dd lowest cost edge between the tree and a vertex that is not part of the tree UNTIL every vertex is part of the tree reedy lgorithm, very similar to ijkstra's Minimum Spanning Tree Minimum Spanning Tree: spanning tree in a weighted graph with the lowest total cost used in network design, taxonomy, Image registration, and more! ost of spanning tree shown? Pick as root Prim's lgorithm 8. None of These 8 S raphs 8 S raphs 8
22 Prim's lgorithm Prim's lgorithm 5 8 Lowest cost edge from tree to vertex not in Tree? from to (or ) S raphs Lowest cost edge from tree to vertex not in Tree? from to (OR from o ) S raphs 8 Prim's lgorithm Prim's lgorithm 5 8 Lowest cost edge from tree to vertex not in Tree? from to S raphs Lowest cost edge from tree to vertex not in Tree? 5 from to S raphs 88
23 5 Prim's lgorithm 8 Lowest cost edge from tree to vertex not in Tree? from to S raphs 89 5 Prim's lgorithm 8 Lowest cost edge from tree to vertex not in Tree? from to S raphs 90 Prim's lgorithm Prim's lgorithm 5 5 Pick as root S raphs 9 Lowest cost edge from tree to vertex not in Tree? from to S raphs 9
24 Prim's lgorithm Prim's lgorithm 5 5 Lowest cost edge from tree to vertex not in Tree? from to S raphs 9 Lowest cost edge from tree to vertex not in Tree? from to S raphs 9 Prim's lgorithm Prim's lgorithm 5 5 Lowest cost edge from tree to vertex not in Tree? from to S raphs 95 Lowest cost edge from tree to vertex not in Tree? 5 from to S raphs 9
25 Prim's lgorithm Prim's lgorithm 5 5 Lowest cost edge from tree to vertex not in Tree? from to S raphs 9 ost of Spanning Tree? S raphs 98 Lots! Other raph lgorithms S raphs 99
An Early Problem in Graph Theory
raphs Topic 2 " Hopefully, you've played around a bit with The Oracle of acon at Virginia and discovered how few steps are necessary to link just about anybody who has ever been in a movie to Kevin acon,
More informationProgramming Abstractions
Programming bstractions S 1 0 6 X ynthia ee Upcoming Topics raphs! 1. asics What are they? ow do we represent them? 2. Theorems What are some things we can prove about graphs? 3. readth-first search on
More informationSingle Source, Shortest Path Problem
Lecture : From ijkstra to Prim Today s Topics: ijkstra s Shortest Path lgorithm epth First Search Spanning Trees Minimum Spanning Trees Prim s lgorithm overed in hapter 9 in the textbook Some slides based
More informationEuler and Hamilton circuits. Euler paths and circuits
1 7 16 2013. uler and Hamilton circuits uler paths and circuits o The Seven ridges of Konigsberg In the early 1700 s, Konigsberg was the capital of ast Prussia. Konigsberg was later renamed Kaliningrad
More informationMinimum Spanning Trees and Shortest Paths
Minimum Spanning Trees and Shortest Paths Prim's algorithm ijkstra's algorithm November, 017 inda eeren / eoffrey Tien 1 Recall: S spanning tree Starting from vertex 16 9 1 6 10 13 4 3 17 5 11 7 16 13
More informationIntroduction to Graphs. common/notes/ppt/
Introduction to Graphs http://people.cs.clemson.edu/~pargas/courses/cs212/ common/notes/ppt/ Introduction Graphs are a generalization of trees Nodes or verticies Edges or arcs Two kinds of graphs irected
More informationUnderstand graph terminology Implement graphs using
raphs Understand graph terminology Implement graphs using djacency lists and djacency matrices Perform graph searches Depth first search Breadth first search Perform shortest-path algorithms Disjkstra
More informationA region is each individual area or separate piece of the plane that is divided up by the network.
Math 135 Networks and graphs Key terms Vertex (Vertices) ach point of a graph dge n edge is a segment that connects two vertices. Region region is each individual area or separate piece of the plane that
More informationMinimum Spanning Trees and Shortest Paths
Minimum Spanning Trees and Shortest Paths Kruskal's lgorithm Prim's lgorithm Shortest Paths pril 04, 018 inda eeren / eoffrey Tien 1 Kruskal's algorithm ata types for implementation Kruskalslgorithm()
More informationCS1800: Graph Algorithms (2nd Part) Professor Kevin Gold
S1800: raph lgorithms (2nd Part) Professor Kevin old Summary So ar readth-irst Search (S) and epth-irst Search (S) are two efficient algorithms for finding paths on graphs. S also finds the shortest path.
More informationCS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014
epartment of omputer Science Virginia Tech lacksburg, Virginia opyright c 04 by lifford. Shaffer : Theory of lgorithms Title page : Theory of lgorithms lifford. Shaffer Spring 04 lifford. Shaffer epartment
More informationUndirected graph is a special case of a directed graph, with symmetric edges
S-6S- ijkstra s lgorithm -: omputing iven a directed weighted graph (all weights non-negative) and two vertices x and y, find the least-cost path from x to y in. Undirected graph is a special case of a
More informationSpanning Tree. Lecture19: Graph III. Minimum Spanning Tree (MSP)
Spanning Tree (015) Lecture1: Graph III ohyung Han S, POSTH bhhan@postech.ac.kr efinition and property Subgraph that contains all vertices of the original graph and is a tree Often, a graph has many different
More informationCampus Tour. 1/18/2005 4:08 AM Campus Tour 1
ampus Tour //00 :0 M ampus Tour Outline and Reading Overview of the assignment Review djacency matrix structure (..) Kruskal s MST algorithm (..) Partition T and implementation (..) The decorator pattern
More informationAnalysis of Algorithms Prof. Karen Daniels
UMass Lowell omputer Science 91.404 nalysis of lgorithms Prof. Karen aniels Spring, 2013 hapter 22: raph lgorithms & rief Introduction to Shortest Paths [Source: ormen et al. textbook except where noted]
More informationCAD Algorithms. Shortest Path
lgorithms Shortest Path lgorithms Mohammad Tehranipoor epartment September 00 Shortest Path Problem: ind the best way of getting from s to t where s and t are vertices in a graph. est: Min (sum of the
More informationReading. Graph Terminology. Graphs. What are graphs? Varieties. Motivation for Graphs. Reading. CSE 373 Data Structures. Graphs are composed of.
Reading Graph Reading Goodrich and Tamassia, hapter 1 S 7 ata Structures What are graphs? Graphs Yes, this is a graph. Graphs are composed of Nodes (vertices) dges (arcs) node ut we are interested in a
More informationL10 Graphs. Alice E. Fischer. April Alice E. Fischer L10 Graphs... 1/37 April / 37
L10 Graphs lice. Fischer pril 2016 lice. Fischer L10 Graphs... 1/37 pril 2016 1 / 37 Outline 1 Graphs efinition Graph pplications Graph Representations 2 Graph Implementation 3 Graph lgorithms Sorting
More informationData Organization: Creating Order Out Of Chaos
ata Organization: reating Order Out Of haos 3 Non-linear data structures 5-5 Principles of omputation, arnegie Mellon University - ORTIN Trees tree is a hierarchical (usually non-linear) data structure.
More informationCampus Tour Goodrich, Tamassia. Campus Tour 1
ampus Tour 00 oodrich, Tamassia ampus Tour raph ssignment oals Learn and implement the adjacency matrix structure an Kruskal s minimum spanning tree algorithm Understand and use the decorator pattern and
More informationGraphs. Reading Assignment. Mandatory: Chapter 3 Sections 3.1 & 3.2. Peeking into Computer Science. Jalal Kawash 2010
Graphs Mandatory: hapter 3 Sections 3.1 & 3.2 Reading ssignment 2 Graphs bstraction of ata 3 t the end of this section, you will be able to: 1.efine directed and undirected graphs 2.Use graphs to model
More informationUnit 7 Day 2 Section Vocabulary & Graphical Representations Euler Circuits and Paths
Unit 7 Day 2 Section 4.3-4.5 Vocabulary & Graphical Representations Euler Circuits and Paths 1 Warm Up ~ Day 2 List the tasks and earliest start times in a table, as in exercise #1. Determine the minimum
More informationNote. Out of town Thursday afternoon. Willing to meet before 1pm, me if you want to meet then so I know to be in my office
raphs and Trees Note Out of town Thursday afternoon Willing to meet before pm, email me if you want to meet then so I know to be in my office few extra remarks about recursion If you can write it recursively
More informationGraphs. Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale Room - Faner 3131
Graphs Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale tessema.mengistu@siu.edu Room - Faner 3131 1 Outline Introduction to Graphs Graph Traversals Finding a
More informationCS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014
epartment of omputer Science Virginia Tech lacksburg, Virginia opyright c 04 by lifford. Shaffer : Theory of lgorithms Title page : Theory of lgorithms lifford. Shaffer Spring 04 lifford. Shaffer epartment
More informationGraphs And Algorithms
Graphs nd lgorithms Mandatory: hapter 3 Sections 3.1 & 3.2 Reading ssignment 2 1 Graphs bstraction of ata 3 t the end of this section, you will be able to: 1. efine directed and undirected graphs 2. Use
More informationUndirected graph is a special case of a directed graph, with symmetric edges
ijkstra s lgorithm 7-: omputing iven a directed weighted graph(all weights non-negative) and two verticesxand y, find the least-cost path fromxtoy in. Undirected graph is a special case of a directed graph,
More informationChapter 9. Greedy Algorithms: Spanning Trees and Minimum Spanning Trees
msc20 Intro to lgorithms hapter. Greedy lgorithms: Spanning Trees and Minimum Spanning Trees The concept is relevant to connected undirected graphs. Problem: Here is a diagram of a prison for political
More informationALGORITHM DESIGN GREEDY ALGORITHMS. University of Waterloo
ALORITHM DSIN RDY ALORITHMS University of Waterloo LIST OF SLIDS - List of Slides reedy Approaches xample: Making Change 4 Making Change (cont.) 5 Minimum Spanning Tree 6 xample 7 Approaches that Don t
More informationSpanning Trees, greedy algorithms. Lecture 22 CS2110 Fall 2017
1 Spanning Trees, greedy algorithms Lecture 22 CS2110 Fall 2017 1 We demo A8 Your space ship is on earth, and you hear a distress signal from a distance Planet X. Your job: 1. Rescue stage: Fly your ship
More informationSec 2. Euler Circuits, cont.
Sec 2. uler ircuits, cont. uler ircuits traverse each edge of a connected graph exactly once. Recall that all vertices must have even degree in order for an uler ircuit to exist. leury s lgorithm is a
More information10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees
//8 About A, Prelim Spanning Trees, greedy algorithms Lecture CS Fall 8 Prelim : Thursday, November. Visit exams page of course website and read carefully to find out when you take it (: or 7:) and what
More informationSpanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018
1 Spanning Trees, greedy algorithms Lecture 20 CS2110 Fall 2018 1 About A6, Prelim 2 Prelim 2: Thursday, 15 November. Visit exams page of course website and read carefully to find out when you take it
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics An Introduction to Graph Theory. Introduction. Definitions.. Vertices and Edges... The Handshaking Lemma.. Connected Graphs... Cut-Points and Bridges.
More informationGraphs: Definitions and Representations (Chapter 9)
oday s Outline Graphs: efinitions and Representations (hapter 9) dmin: HW #4 due hursday, Nov 10 at 11pm Memory hierarchy Graphs Representations SE 373 ata Structures and lgorithms 11/04/2011 1 11/04/2011
More informationSec 7.1 EST Graphs Networks & Graphs
Sec 7.1 ST raphs Networks & raphs Name: These graphs are models to find the RLIST TIM any particular job can STRT. What do you think is meant in a team by the following statement? You are only as fast
More informationSpanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS
Spanning Trees S: ata Structures & lgorithms Lecture : Minimum Spanning Trees simple problem: iven a connected undirected graph =(V,), find a minimal subset of edges such that is still connected graph
More informationGraphs: Definitions and Representations (Chapter 9)
oday s Outline Graphs: efinitions and Representations (hapter 9) SE 373 ata Structures and lgorithms dmin: Homework #4 - due hurs, Nov 8 th at 11pm Midterm 2, ri Nov 16 Memory hierarchy Graphs Representations
More informationSAMPLE. MODULE 5 Undirected graphs
H P T R MOUL Undirected graphs How do we represent a graph by a diagram and by a matrix representation? How do we define each of the following: graph subgraph vertex edge (node) loop isolated vertex bipartite
More informationSpanning Trees 4/19/17. Prelim 2, assignments. Undirected trees
/9/7 Prelim, assignments Prelim is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for details. Deadline for submitting conflicts has passed.
More informationSpanning Trees. Lecture 22 CS2110 Spring 2017
1 Spanning Trees Lecture 22 CS2110 Spring 2017 1 Prelim 2, assignments Prelim 2 is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for
More informationmywbut.com Uninformed Search
Uninformed Search 1 2.4 Search Searching through a state space involves the following: set of states Operators and their costs Start state test to check for goal state We will now outline the basic search
More informationCS 206 Introduction to Computer Science II
CS 206 Introduction to Computer Science II 04 / 06 / 2018 Instructor: Michael Eckmann Today s Topics Questions? Comments? Graphs Definition Terminology two ways to represent edges in implementation traversals
More informationLesson 5.5. Minimum Spanning Trees. Explore This
Lesson. St harles ounty Minimum Spanning Trees s in many of the previous lessons, this lesson focuses on optimization. Problems and applications here center on two types of problems: finding ways of connecting
More informationChapter 9 Graph Algorithms
Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)
More informationAdvanced Data Structures and Algorithms
dvanced ata Structures and lgorithms ssociate Professor r. Raed Ibraheem amed University of uman evelopment, College of Science and Technology Computer Science epartment 2015 2016 epartment of Computer
More informationCS1 Lecture 31 Apr. 3, 2019
CS Lecture 3 Apr. 3, 209 HW6 due Fri. Q3: think carefully about overlaps draw pictures Think dimension by dimension three D problems if they don t overlap in x, they don t overlap» Express this in terms
More information11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions
Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is
More informationCSE 332: Data Structures & Parallelism Lecture 19: Introduction to Graphs. Ruth Anderson Autumn 2018
SE 332: ata Structures & Parallelism Lecture 19: Introduction to Graphs Ruth nderson utumn 2018 Today Graphs Intro & efinitions 11/19/2018 2 Graphs graph is a formalism for representing relationships among
More informationCSE 373: Data Structures and Algorithms. Graph Traversals. Autumn Shrirang (Shri) Mare
SE 373: ata Structures and lgorithms Graph Traversals utumn 2018 Shrirang (Shri) Mare shri@cs.washington.edu Thanks to Kasey hampion, en Jones, dam lank, Michael Lee, Evan Mcarty, Robbie Weber, Whitaker
More informationLecture 13: Weighted Shortest Paths. These slides include material originally prepared by Dr. Ron Cytron and Dr. Steve Cole.
Lecture : Weighted Shortest Paths These slides include material originally prepared by r. Ron ytron and r. Steve ole. nnouncements Lab code and post-lab due tonight Lab released tomorrow ijkstra s algorithm
More informationCHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ - artale/z
CHAPTER 10 GRAPHS AND TREES Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/z SECTION 10.1 Graphs: Definitions and Basic Properties Copyright Cengage Learning. All rights reserved. Graphs: Definitions
More informationECE 242 Data Structures and Algorithms. Graphs II. Lecture 27. Prof.
242 ata Structures and lgorithms http://www.ecs.umass.edu/~polizzi/teaching/242/ Graphs II Lecture 27 Prof. ric Polizzi Summary Previous Lecture omposed of vertices (nodes) and edges vertex or node edges
More informationEulerian Cycle (2A) Young Won Lim 5/11/18
ulerian ycle (2) opyright (c) 2015 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the NU ree ocumentation License, Version 1.2 or any later
More informationGraphs: Topological Sort / Graph Traversals (Chapter 9)
Today s Outline raphs: Topological Sort / raph Traversals (hapter 9) S 373 ata Structures and lgorithms dmin: omework #4 - due Thurs, Nov 8 th at pm Midterm 2, ri Nov 6 raphs Representations Topological
More informationL Modelling and Simulating Social Systems with MATLAB
851-0585-04L Modelling and Simulating Social Systems with MATLAB Lesson 6 Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano and S. Wehrli) ETH Zürich 2010-03-29 Lesson 6 Contents History:
More informationChapter 9 Graph Algorithms
Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures Chapter 9 Graph s 2 Definitions Definitions an undirected graph is a finite set
More information11/26/17. directed graphs. CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10. undirected graphs
directed graphs S 220: iscrete Structures and their pplications collection of vertices and directed edges graphs zybooks chapter 10 collection of vertices and edges undirected graphs What can this represent?
More informationChapter 9 Graph Algorithms
Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a
More information11-5 Networks. Königsberg Bridge Problem
Section 11-5 Networks 1 11-5 Networks In the 1700s, the people of Königsberg, Germany (now Kaliningrad in Russia), used to enjoy walking over the bridges of the Pregel River. There were three landmasses
More informationKonigsberg Bridge Problem
Graphs Konigsberg Bridge Problem c C d g A Kneiphof e D a B b f c A C d e g D a b f B Euler s Graph Degree of a vertex: the number of edges incident to it Euler showed that there is a walk starting at
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 informationCS 3410 Ch 14 Graphs and Paths
CS 3410 Ch 14 Graphs and Paths Sections 14.1-14.3 Pages 527-552 Exercises 1,2,5,7-9 14.1 Definitions 1. A vertex (node) and an edge are the basic building blocks of a graph. Two vertices, (, ) may be connected
More informationGraph Theory CS/Math231 Discrete Mathematics Spring2015
1 Graphs Definition 1 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 is called the vertex set of G, and its elements are called vertices
More informationSPANNING TREES. Lecture 21 CS2110 Spring 2016
1 SPANNING TREES Lecture 1 CS110 Spring 016 Spanning trees What we do today: Calculating the shortest path in Dijkstra s algorithm Look at time complexity of shortest path Definitions Minimum spanning
More informationShortest Paths and Minimum Spanning Trees
/9/ hortest Paths and Minimum panning Trees dmin avid Kauchak cs0 pring 0 ijkstra s algorithm What about ijkstra s on? 0-0 /9/ What about ijkstra s on? ijkstra s algorithm only works for positive edge
More informationSpanning Trees. Lecture 20 CS2110 Spring 2015
1 Spanning Trees Lecture 0 CS110 Spring 01 1 Undirected trees An undirected graph is a tree if there is exactly one simple path between any pair of vertices Root of tree? It doesn t matter choose any vertex
More informationBreadth First Search. Graph Traversal. CSE 2011 Winter Application examples. Two common graph traversal algorithms
Breadth irst Search CSE Winter Graph raversal Application examples Given a graph representation and a vertex s in the graph ind all paths from s to the other vertices wo common graph traversal algorithms
More informationGraphs. What is a Graph? Computer Science S-111 Harvard University David G. Sullivan, Ph.D.
Unit 10 Graphs Computer Science S-111 Harvard University David G. Sullivan, Ph.D. What is a Graph? vertex / node edge / arc e b d f h j a c i g A graph consists of: a set of vertices (also known as nodes)
More informationLECTURE 26 PRIM S ALGORITHM
DATA STRUCTURES AND ALGORITHMS LECTURE 26 IMRAN IHSAN ASSISTANT PROFESSOR AIR UNIVERSITY, ISLAMABAD STRATEGY Suppose we take a vertex Given a single vertex v 1, it forms a minimum spanning tree on one
More informationGraph Algorithms. A Brief Introduction. 高晓沨 (Xiaofeng Gao) Department of Computer Science Shanghai Jiao Tong Univ.
Graph Algorithms A Brief Introduction 高晓沨 (Xiaofeng Gao) Department of Computer Science Shanghai Jiao Tong Univ. 目录 2015/5/7 1 Graph and Its Applications 2 Introduction to Graph Algorithms 3 References
More informationGRAPH THEORY. What are graphs? Why graphs? Graphs are usually used to represent different elements that are somehow related to each other.
GRPH THEORY Hadrian ng, Kyle See, March 2017 What are graphs? graph G is a pair G = (V, E) where V is a nonempty set of vertices and E is a set of edges e such that e = {a, b where a and b are vertices.
More informationGraph ADT. Lecture18: Graph II. Adjacency Matrix. Representation of Graphs. Data Vertices and edges. Methods
Graph T S33: ata Structures (0) Lecture8: Graph II ohyung Han S, POSTH bhhan@postech.ac.kr ata Vertices and edges endvertices(e): an array of the two endvertices of e opposite(v,e): the vertex opposite
More informationReading. Graph Introduction. What are graphs? Graphs. Motivation for Graphs. Varieties. Reading. CSE 373 Data Structures Lecture 18
Reading Graph Introduction Reading Section 9.1 S 373 ata Structures Lecture 18 11/25/02 Graph Introduction - Lecture 18 2 What are graphs? Yes, this is a graph. Graphs Graphs are composed of Nodes (vertices)
More informationMath for Liberal Arts MAT 110: Chapter 13 Notes
Math for Liberal Arts MAT 110: Chapter 13 Notes Graph Theory David J. Gisch Networks and Euler Circuits Network Representation Network: A collection of points or objects that are interconnected in some
More informationArtificial Intelligence (Heuristic Search)
Artificial Intelligence (Heuristic Search) KR Chowdhary, Professor & Head Email: kr.chowdhary@acm.org Department of Computer Science and Engineering MBM Engineering College, Jodhpur kr chowdhary heuristic
More informationCISC 320 Introduction to Algorithms Fall Lecture 15 Depth First Search
IS 320 Introduction to lgorithms all 2014 Lecture 15 epth irst Search 1 Traversing raphs Systematic search of every edge and vertex of graph (directed or undirected) fficiency: each edge is visited no
More informationShortest Paths and Minimum Spanning Trees
// hortest Paths and Minimum panning Trees avid Kauchak cs pring dmin an resubmit homeworks - for up to half credit back l ue by the end of the week Read book // // // // // Is ijkstra s algorithm correct?
More informationthe Further Mathematics network V SUMMARY SHEET DECISION MATHS Algorithms Input A and B (positive integers)
the urther Mathematics network www.fmnetwork.org.uk V 07 SUMMRY SHT ISION MTHS lgorithms The main ideas are covered in Q dexcel MI OR The main ideas in this topic are Understanding and implementing a variety
More informationCS 106X, Lecture 23 Dijkstra and A* Search
CS 106X, Lecture 23 Dijkstra and A* Search reading: Programming Abstractions in C++, Chapter 18 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative Commons
More informationGraphs Slide 1/18. Graphs. Fall Semester. Artificial Intelligence
Graphs Slide 1/18 Graphs Fall Semester Graphs Slide 2/18 Topic Outline Definitions Node Edge Path Examples Representation Edge list Neighbor list Adjacency matrix Python Code Hash table Key is node Value
More informationCSE 100: GRAPH ALGORITHMS
CSE 100: GRAPH ALGORITHMS 2 Graphs: Example A directed graph V5 V = { V = E = { E Path: 3 Graphs: Definitions A directed graph V5 V6 A graph G = (V,E) consists of a set of vertices V and a set of edges
More informationUNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list
UNIT-4 Graph: Terminology, Representation, Traversals Applications - spanning trees, shortest path and Transitive closure, Topological sort. Sets: Representation - Operations on sets Applications. 1. Name
More informationElementary Graph Algorithms: Summary. Algorithms. CmSc250 Intro to Algorithms
Elementary Graph Algorithms: Summary CmSc250 Intro to Algorithms Definition: A graph is a collection (nonempty set) of vertices and edges A path from vertex x to vertex y : a list of vertices in which
More informationWhat are graphs? (Take 1)
Lecture 22: Let s Get Graphic Graph lgorithms Today s genda: What is a graph? Some graphs that you already know efinitions and Properties Implementing Graphs Topological Sort overed in hapter 9 of the
More informationToday s Outline. CSE 326: Data Structures. Topic #15: Cool Graphs n Pretty Pictures. A Great Mathematician. The Bridges of Königsberg
CSE 326: Data Structures Topic #15: Cool Graphs n Pretty Pictures Ashish Sabharwal Autumn, 2003 Today s Outline Admin Project 3 in-progress checkin due tonight! Graph Algorithms Representation Applications
More informationIntroduction to Engineering Systems, ESD.00. Networks. Lecturers: Professor Joseph Sussman Dr. Afreen Siddiqi TA: Regina Clewlow
Introduction to Engineering Systems, ESD.00 Lecture 7 Networks Lecturers: Professor Joseph Sussman Dr. Afreen Siddiqi TA: Regina Clewlow The Bridges of Königsberg The town of Konigsberg in 18 th century
More informationSAMPLE. Networks. A view of Königsberg as it was in Euler s day.
ack to Menu >>> How are graphs used to represent networks? H P T R 10 Networks How do we analyse the information contained in graphs? How do we use graphs to represent everyday situations? 10.1 Graph theory
More informationVarying Applications (examples)
Graph Theory Varying Applications (examples) Computer networks Distinguish between two chemical compounds with the same molecular formula but different structures Solve shortest path problems between cities
More information1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))
10 Graphs 10.1 Graphs and Graph Models 1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G)) 2. an edge is present, say e = {u,
More informationGrade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015
Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015 The Seven Bridges of Königsberg In
More informationMinimum spanning trees
Carlos Moreno cmoreno @ uwaterloo.ca EI-3 https://ece.uwaterloo.ca/~cmoreno/ece5 Standard reminder to set phones to silent/vibrate mode, please! During today's lesson: Introduce the notion of spanning
More informationAgenda. Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp
Graph Charles Lin genda Graph Representation FS BFS ijkstra * Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp Graph Representation djacency Matrix bool way[100][100];
More informationCS61BL. Lecture 5: Graphs Sorting
CS61BL Lecture 5: Graphs Sorting Graphs Graphs Edge Vertex Graphs (Undirected) Graphs (Directed) Graphs (Multigraph) Graphs (Acyclic) Graphs (Cyclic) Graphs (Connected) Graphs (Disconnected) Graphs (Unweighted)
More informationCSC 421: Algorithm Design & Analysis. Spring 2015
CSC 421: Algorithm Design & Analysis Spring 2015 Greedy algorithms greedy algorithms examples: optimal change, job scheduling Prim's algorithm (minimal spanning tree) Dijkstra's algorithm (shortest path)
More information3.1 Basic Definitions and Applications
Graphs hapter hapter Graphs. Basic efinitions and Applications Graph. G = (V, ) n V = nodes. n = edges between pairs of nodes. n aptures pairwise relationship between objects: Undirected graph represents
More informationGraphs Introduction and Depth first algorithm
Graphs Introduction and Depth first algorithm Carol Zander Introduction to graphs Graphs are extremely common in computer science applications because graphs are common in the physical world. Everywhere
More informationCHAPTER FOURTEEN GRAPH THEORY
HPTR OURTN RPH THORY xercise Set 14.1 1. graph is a finite set of points, called vertices, that are connected with line segments, called edges. 2. 3. 4. The degree of a vertex is the number of edges that
More informationApplications of BFS and DFS
pplications of S and S S all // : PM Some pplications of S and S S o find the shortest path from a vertex s to a vertex v in an unweighted graph o find the length of such a path o construct a S tree/forest
More informationEulerian Cycle (2A) Young Won Lim 5/25/18
ulerian ycle (2) opyright (c) 2015 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU ree ocumentation License, Version 1.2 or any later
More information