Graphs and Genetics. Outline. Computational Biology IST. Ana Teresa Freitas 2015/2016. Slides source: AED (MEEC/IST); Jones and Pevzner (book)

Size: px
Start display at page:

Download "Graphs and Genetics. Outline. Computational Biology IST. Ana Teresa Freitas 2015/2016. Slides source: AED (MEEC/IST); Jones and Pevzner (book)"

Transcription

1 raphs and enetics Computational Biology IST Ana Teresa Freitas / Slides source: AED (MEEC/IST); Jones and Pevzner (book) Outline l Motivacion l Introduction to raph Theory l Eulerian & Hamiltonian Cycle Problems l Benzer Experiment and Internal raphs

2 Sequencing Clone-by-clone shotgun sequencing Human enome Project Whole-genome shotgun sequencing Celera enomics (BACs) E-learning examples

3 The Bridge Obsession Problem Find a tour crossing every bridge just once Leonhard Euler, 7 Bridges of Königsberg Eulerian Cycle Problem l Find a cycle that visits every edge exactly once l Linear time

4 Applications l Maps l Hypertexts l Circuits l Schedules l Networks l Fragment Assembly in DNA Sequencing l Protein Sequencing and Identification l Biological networks l Brain connectome Introduction to raph Theory l Abstract object l Entities l Edges l Vertices or nodes l Vertices represent l People, places, genes, sequences l Edges represent l connections

5 Definitions l A graph is a set of vertices plus a set of edges that connect pairs of distinct vertices (with at most one edge connecting any pair of vertices) l When there is an edge connecting two vertices, we say that the vertices are adjacent to one another and that the edge is incident on both vertices Definitions l The degree of a vertex is the number of edges incident to the vertex l A subgraph of a graph is a graph whose vertex and edge sets are subsets of those of l A supergraph of a graph is a graph that contains as a subgraph

6 Example: 8 7 l l l Vertices and 7 are adjacent Vertices and are non-adjacent Vertex 7 has degree four Definitions l A walk is an alternating sequence of vertices and edges, beginning and ending with a vertex, in which each vertex is incident to the two edges that precede and follow it in the sequence, and the vertices that precede and follow an edge are the endvertices of that edge l A walk is closed if its first and last vertices are the same, and open if they are different (path) l The length L of a walk is the number of edges that it uses

7 Definitions l A simple path is a walk in which all vertices and edges are distinct l The closed equivalent to this type of walk is called a cycle l Two paths are internally disjoint if they do not have any vertex in common, except the first and last ones Example: 8 7 l Path:

8 Example: 8 7 l Cycle: Definitions l The graph is said to be connected if it is possible to establish a path from any vertex to any other vertex of a graph l A component is a maximally connected subgraph l A spanning graph H of a graph, is a graph that has the same vertex set as 8

9 Definitions l A tree is a connected acyclic simple graph. A vertex of degree is called a leaf l A set of trees is called a forest l A spanning tree is a spanning subgraph that is a tree l A k-ary tree is a rooted tree in which every internal vertex has k children Example: raph 8 7 l is a subgraph of l is a connected graph but is not l Subgraph has a component and a tree 9

10 Example: 8 7 l : Spanning tree of. raph properties l raphs with all edges present are called complete graphs l A complete subgraph is called a clique l We define the complement of a graph by starting with a complete graph that has the same set of vertices as the original graph, and removing the edges of

11 raph properties l A graph with V vertices has at most V(V-)/ edges l A dense graph is a graph whose average vertex degree is proportional to V l A sparse graph is a graph whose complement is dense l The density of a graph is the average degree, or E/V. E is the number of edges and V the number of vertices raph properties l A bipartide graph is a graph whose vertices we can divide into two sets such that all edges connect a vertex in one set with a vertex in the other set l raphs as defined to this point are called undirected graphs l In directed graphs, also known as digraphs, edges are one-way

12 raph properties l The first vertex in a directed edge is called the source, the second vertex is called the destination l The indegree of a vertex is the number of edges where it is the destination l The outdegree of a vertex is the number of edges where it is the source raph properties l A directed cycle in a digraph is a cycle in which all adjacent vertex pairs appear in the order indicated by (directed) graph edges l A directed acyclic graph (DA), is a digraph that has no directed cycles l A DA (an acyclic digraph) is not the same as a tree (na acyclic undirected graph)

13 raph properties l In weighted graphs, we associate numbers (weights) with each edge, which generally represents a distance or a cost l We also might associate a weight with each vertex, or multiple weights with each vertex and edge l Weighted digraphs are also refered as networks Adjacency-matrix l raph Matrix Size: V V symmetric

14 Adjacency-lists raph Lists Array of size V Linked list that is associated with that vertex Adj. Matrix main advantages l Should be used when: l there is space available; l for dense graphs; l the algorithms performs more than V operations. l Insert and remove is very efficient; l Simple to avoid parallel edges; l Simple to check if two vertices are connected

15 Adj. Lists main advantages l Initialization proportional to V. l Space proportional to V+E l Useful to represent sparse graphs l Edges insertion is very efficient raphs - First Problems l Simple Path l iven two vertices of a graph, identify if they are connected l Hamilton Path l iven two vertices of a graph, identify if there is a path that visits all the vertices exactly once l Euler Path l iven two vertices of a graph, identify if there is a path that visits all the edges exactly once

16 raphs Simple path l Call the algorithm with the following parameters: l, the graph l v, the initial vertex l w, the end vertex l Based in a depth first search. l From vertex v, find the first adjacent vertex, t. Call the algorithm recursively to find w from t. l The visited vector is used to verify that each vertex is visited only once. raphs Simple path int RAPHpath(raph, int v, int w) { int t; for (t = ; t < ->V; t++) visited[t] = ; return pathr(, v, w); }

17 raphs Simple path static int visited[maxv]; int pathr(raph, int v, int w) { int t; if (v == w) return ; visited[v] = ; for (t = ; t < ->V; t++) if (->adj[v][t] == ) if (visited[t] == ) if (pathr(, t, w)) return ; return ; } raphs Simple path 7 Call the algorithm to find a path from vertex to vertex The graph is represented by an Adjacency-matrix RAPHpath(,, ) 7

18 raphs Simple path l Calls of function pathr pathr(,, ) 7 raphs Simple path l Calls of function pathr 7 - pathr(,, ) pathr(,, ) -; ( and visited) - (not adjacent) 8

19 raphs Simple path l Calls of function pathr 7 pathr(,, ) - pathr(,, ) -; ( and visited) - (not adjacent) - pathr(,, ) -; ( and visited) raphs Simple path l Calls of function pathr 7 pathr(,, ) - pathr(,, ) -; ( and visited) - (not adjacent) - pathr(,, ) -; ( and visited) - pathr(,, ) -; (not adjacent) - (visited)... 9

20 raphs Simple path l Call of functions pathr 7. - ( visited). -; (not adjacent). - pathr(,, ) raphs Simple path l Calls of functions pathr 7 Nodes visited:. - ( visited). -; (not adjacent). - pathr(,, ) -; (not adjacent) - ( visited) - (not adjacent) - pathr(,, )

21 Exercice simple path 7 Call the algorithm to find a path from vertex to vertex. Present the list of visited nodes. The graph is represented by an Adjacency-matrix RAPHpath(,, ) Hamilton path l Hamilton path l iven two vertices, is there a simple path connecting them that visits every vertex in the graph exactly once? l If the path is from a vertex back to itself, this problem is known as the Hamilton tour problem. l Property: A recursive search for a Hamilton tour could take exponential time.

22 Hamilton path l This algorithm is very similar to the algorithm for finding simple paths. l Why are the running times dramatically different? l The simple path algorithm is guaranteed to finish quickly because it sets at least one element of the visited array to each time pathr is called l The Hamilton path algorithm can set visited elements back to. We cannot guarantee that it will finish quickly Hamilton path static int visited[maxv]; int pathr(raph, int v, int w, int int d d) {int t; if (v == w) { return if (d == ; ) return ; else return ;} visited[v] = ; for (t = ; t < ->V; t++) if (->adj[v][t] == ) if (visited[t] == ) if (pathr(, t, w, d-)) d- return ; visited[v] = ; visited[v] = ; return ;} int RAPHpathH(raph H, int v, int w) { int t; for (t = ; t < ->V; t++) visited[t] = ; return pathr(, v, w, ->V- ->V-); }

23 Hamilton path Compute a simple path connecting between and that visits every vertex in the graph exactly once RAPHpathH(,, ) Hamilton path l Calls of function pathr pathr(,,,) - ( visited)

24 Hamilton path l Calls of function pathr pathr(,,,) - ( visited) - pathr(,,,) -; ( and visited) Hamilton path l Calls of function pathr pathr(,,,) - ( visited) - pathr(,,,) -; ( and visited) - pathr(,,,) -;; (,, and visited) -; (not adjacent)

25 Hamilton path l Calls of function pathr pathr(,,,) - ( visited) - pathr(,,,) -; ( and visited) - pathr(,,,) -;; (, and visited) -; (not adjacent) (return with vertex as not visited) Hamilton path l Calls of function pathr pathr(,,,) - ( visited) - pathr(,,,) -; ( and visited) - pathr(,,,) -;; (, and visited) -; (not adjacent) (return with vertex as not visited) - pathr(,,,) - (not adjacent) (...)

26 Hamilton path l Calls of function pathr (...) - ( visited) - (not adjacent) - ( visited) - pathr(,,,) Hamilton path l Calls of function pathr (...) - ( visited) - (not adjacent) - ( visited) - pathr(,,,) (d >, return e clean )

27 Hamilton path l Calls of function pathr (...) - ( visited) - (not adjacent) - ( visited) - pathr(,,,) (d >, return e clean ) (return cleaning ) - (not adjacent) Hamilton path l Calls of function pathr (...) - ( visited) - (not adjacent) - ( visited) - pathr(,,,) (d >, return e clean ) (return cleaning ) - (not adjacent) (return cleaning ) 7

28 Hamilton path l Calls sequence: pathr (...) - ( visited) - (non adjacent) - ( visited) - pathr(,,,) (d >, return and remove ) (return removing ) - (non adjacent) (return removing ) - pathr(,,,) (...) Hamilton path l Calls sequence: pathr (...) - ( visited) - pathr(,,,) -;; (, and visited) 8

29 Hamilton path l Calls sequence: pathr (...) - ( visited) - pathr(,,,) -;; (, and visited) - pathr(,,,) - (non adjacent) -;; (, and visited) - pathr(,,,) (d ==, path found) (...) (Path found!) Euler path and tour l Euler path l Is there a path connecting two given vertices that uses each edge in the graph exactly once? l The path need not to be simple vertices may be visited multiple times l If the path is from a vertex back to itself, we have the Euler tour problem 9

30 raphs Euler path in linear time Adj. List #include STACK.h int path(raph, int v) { int w; for (; ->adj[v]!= NULL; v = w) { STACKpush(v); To STACK w = ->adj[v]->v; RAPHremoveE(, EDE(v,w)); } return v; } int raphpathe(raph,int v,int w) { STACKinit(->E); printf( %d, w); while ( (path(,v) == v && (!STACKempty()) ) printf( -%d, v = STACKpop()); printf( \n ); return (->E == ); } Create STACK of size E From STACK Euler path and tour l Property: A graph has a Euler tour if and only if it is connected and all its vertices are of even degree l Corollary: A graph has a Euler path if and only if it is connected and exactly two of its vertices are of odd degree

31 Euler path Adjacency list l : l : - l : l : - l : l : - l : - RAPHpathE(,, ) write Euler path l Call RAPHremoveE path(, ) - push() - (it was removed)

32 Euler path l Call RAPHremoveE path(, ) - push() - (it was removed) - push() Euler path l Call RAPHremoveE path(, ) - push() - (it was removed) - push() - push() -; (it was removed)

33 Euler path l Call RAPHremoveE path(, ) - push() - (it was removed) - push() - push() -; (it was removed) - push() - (it was removed) Euler path l Call RAPHremoveE path(, ) - push() - (it was removed) - push() - push() -; (it was removed) - push() - (it was removed) - push()

34 Euler path l Call RAPHremoveE path(, ) - push() - (it was removed) - push() - push() -; (it was removed) - push() - (it was removed) - push() -* push() * Assume vertex in the list before vertices and Euler path Call RAPHremoveE - push() isolated return()

35 Euler path Call RAPHremoveE - push() isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) Euler path Call RAPHremoveE - push() isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) - push()

36 Euler path Call RAPHremoveE - push() isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) - push() - push() Euler path Call RAPHremoveE - push() isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) - push() - push() - push() isolated return() pop() write -

37 Euler path Call RAPHremoveE path(, ) isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) isolated return() pop() write - Euler path Call RAPHremoveE path(, ) isolated return() pop() write - path(, ) isolated return() pop() write - path(, ) isolated return() pop() write - The path

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies Graph Chapter 9 Outline Introduction Definitions and Basic Terminologies Representations of Graphs Graph Traversals Breadth first traversal Depth first traversal Applications Single source shortest path

More information

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia) 15-251 Great Ideas in Theoretical Computer Science Lecture 12: Graphs I: The Basics February 22nd, 2018 Crossing bridges Königsberg (Prussia) Now Kaliningrad (Russia) Is there a way to walk through the

More information

Graph Theory. ICT Theory Excerpt from various sources by Robert Pergl

Graph Theory. ICT Theory Excerpt from various sources by Robert Pergl Graph Theory ICT Theory Excerpt from various sources by Robert Pergl What can graphs model? Cost of wiring electronic components together. Shortest route between two cities. Finding the shortest distance

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/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 information

Chapter 9 Graph Algorithms

Chapter 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 information

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees Axiomatizing Arithmetic Logic: The Big Picture Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include:

More information

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies: UNIT 5 CSE 103 - Unit V- Graph GRAPH Graph is another important non-linear data structure. In tree Structure, there is a hierarchical relationship between, parent and children that is one-to-many relationship.

More information

CS 4407 Algorithms Lecture 5: Graphs an Introduction

CS 4407 Algorithms Lecture 5: Graphs an Introduction CS 4407 Algorithms Lecture 5: Graphs an Introduction Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Motivation Importance of graphs for algorithm design applications

More information

Graph Algorithms Using Depth First Search

Graph 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 information

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

DS 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 information

Elements of Graph Theory

Elements of Graph Theory Elements of Graph Theory Quick review of Chapters 9.1 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly skip shortest paths (Chapter 9.6), as that was covered

More information

Chapter 2 Graphs. 2.1 Definition of Graphs

Chapter 2 Graphs. 2.1 Definition of Graphs Chapter 2 Graphs Abstract Graphs are discrete structures that consist of vertices and edges connecting some of these vertices. Graphs have many applications in Mathematics, Computer Science, Engineering,

More information

Graph and Digraph Glossary

Graph 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 information

Foundations of Discrete Mathematics

Foundations of Discrete Mathematics Foundations of Discrete Mathematics Chapter 12 By Dr. Dalia M. Gil, Ph.D. Trees Tree are useful in computer science, where they are employed in a wide range of algorithms. They are used to construct efficient

More information

Chapter 9 Graph Algorithms

Chapter 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 information

Lecture 5: Graphs & their Representation

Lecture 5: Graphs & their Representation Lecture 5: Graphs & their Representation Why Do We Need Graphs Graph Algorithms: Many problems can be formulated as problems on graphs and can be solved with graph algorithms. To learn those graph algorithms,

More information

Chapter 9 Graph Algorithms

Chapter 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 information

Understand graph terminology Implement graphs using

Understand 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 information

Math 776 Graph Theory Lecture Note 1 Basic concepts

Math 776 Graph Theory Lecture Note 1 Basic concepts Math 776 Graph Theory Lecture Note 1 Basic concepts Lectured by Lincoln Lu Transcribed by Lincoln Lu Graph theory was founded by the great Swiss mathematician Leonhard Euler (1707-178) after he solved

More information

Ma/CS 6a Class 8: Eulerian Cycles

Ma/CS 6a Class 8: Eulerian Cycles Ma/CS 6a Class 8: Eulerian Cycles By Adam Sheffer The Bridges of Königsberg Can we travel the city while crossing every bridge exactly once? 1 How Graph Theory was Born Leonhard Euler 1736 Eulerian Cycle

More information

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar. UPPSALA UNIVERSITET Matematiska institutionen Anders Johansson Graph Theory Frist, KandMa, IT 010 10 1 Problem sheet 4 Exam questions Solve a subset of, say, four questions to the problem session on friday.

More information

Introduction III. Graphs. Motivations I. Introduction IV

Introduction III. Graphs. Motivations I. Introduction IV Introduction I Graphs Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Graph theory was introduced in the 18th century by Leonhard Euler via the Königsberg

More information

An Introduction to Graph Theory

An Introduction to Graph Theory An Introduction to Graph Theory CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 12:00, Friday 17 th February 2012 Outline 1 Graphs 2 Paths and cycles 3 Graphs and

More information

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow Graph Theory Connectivity, Coloring, Matching Arjun Suresh 1 1 GATE Overflow GO Classroom, August 2018 Thanks to Subarna/Sukanya Das for wonderful figures Arjun, Suresh (GO) Graph Theory GATE 2019 1 /

More information

Konigsberg Bridge Problem

Konigsberg 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 information

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Graph 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 information

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

CS473-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 information

EECS 1028 M: Discrete Mathematics for Engineers

EECS 1028 M: Discrete Mathematics for Engineers EECS 1028 M: Discrete Mathematics for Engineers Suprakash Datta Office: LAS 3043 Course page: http://www.eecs.yorku.ca/course/1028 Also on Moodle S. Datta (York Univ.) EECS 1028 W 18 1 / 15 Graphs: Motivations

More information

Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path

Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path Homework 5: Graphs, Minimum Spanning Trees, and Dijkstra Shortest-Path 1. (4 points) A graph is Hamiltonian if there is a cycle in the graph visiting each vertex exactly once. Give an example of an Eulerian

More information

Graph Theory. Probabilistic Graphical Models. L. Enrique Sucar, INAOE. Definitions. Types of Graphs. Trajectories and Circuits.

Graph Theory. Probabilistic Graphical Models. L. Enrique Sucar, INAOE. Definitions. Types of Graphs. Trajectories and Circuits. Theory Probabilistic ical Models L. Enrique Sucar, INAOE and (INAOE) 1 / 32 Outline and 1 2 3 4 5 6 7 8 and 9 (INAOE) 2 / 32 A graph provides a compact way to represent binary relations between a set of

More information

Fundamental Properties of Graphs

Fundamental Properties of Graphs Chapter three In many real-life situations we need to know how robust a graph that represents a certain network is, how edges or vertices can be removed without completely destroying the overall connectivity,

More information

1 Digraphs. Definition 1

1 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 information

Discrete mathematics II. - Graphs

Discrete mathematics II. - Graphs Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,

More information

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Note 13 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite to writing a

More information

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v. Graph Adjacent Endpoint of an edge Incident Neighbors of a vertex Degree of a vertex Theorem Graph relation Order of a graph Size of a graph Maximum and minimum degree Let G = (V, E) be a graph. If u,

More information

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

MAT 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 information

Introduction to Graphs

Introduction to Graphs Introduction to Graphs Historical Motivation Seven Bridges of Königsberg Königsberg (now Kaliningrad, Russia) around 1735 Problem: Find a walk through the city that would cross each bridge once and only

More information

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph Graphs and Trees Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) who is connected to whom Web search views web pages as a graph Who points to whom Niche graphs (Ecology):

More information

K 4 C 5. Figure 4.5: Some well known family of graphs

K 4 C 5. Figure 4.5: Some well known family of graphs 08 CHAPTER. TOPICS IN CLASSICAL GRAPH THEORY K, K K K, K K, K K, K C C C C 6 6 P P P P P. Graph Operations Figure.: Some well known family of graphs A graph Y = (V,E ) is said to be a subgraph of a graph

More information

GRAPHICAL ALGORITHMS. UNIT _II Lecture-12 Slides No. 3-7 Lecture Slides No Lecture Slides No

GRAPHICAL ALGORITHMS. UNIT _II Lecture-12 Slides No. 3-7 Lecture Slides No Lecture Slides No GRAPHICAL ALGORITHMS UNIT _II Lecture-12 Slides No. 3-7 Lecture-13-16 Slides No. 8-26 Lecture-17-19 Slides No. 27-42 Topics Covered Graphs & Trees ( Some Basic Terminologies) Spanning Trees (BFS & DFS)

More information

Outline. Graphs. Divide and Conquer.

Outline. Graphs. Divide and Conquer. GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.

More information

CHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW

CHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW SFO ORD CHAPTER 14 GRAPH ALGORITHMS LAX DFW ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER (WILEY 2016) GRAPH

More information

Graphs & Digraphs Tuesday, November 06, 2007

Graphs & Digraphs Tuesday, November 06, 2007 Graphs & Digraphs Tuesday, November 06, 2007 10:34 PM 16.1 Directed Graphs (digraphs) like a tree but w/ no root node & no guarantee of paths between nodes consists of: nodes/vertices - a set of elements

More information

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur Lecture : Graphs Rajat Mittal IIT Kanpur Combinatorial graphs provide a natural way to model connections between different objects. They are very useful in depicting communication networks, social networks

More information

Algorithms. Graphs. Algorithms

Algorithms. Graphs. Algorithms Algorithms Graphs Algorithms Graphs Definition: A graph is a collection of edges and vertices. Each edge connects two vertices. Algorithms 1 Graphs Vertices: Nodes, points, computers, users, items,...

More information

Introduction to Graph Theory

Introduction to Graph Theory Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex

More information

BACKGROUND: A BRIEF INTRODUCTION TO GRAPH THEORY

BACKGROUND: 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 information

Graph theory: basic concepts

Graph theory: basic concepts Graph theory: basic concepts Graphs and networks allow modelling many different decision problems Graphs permit to represent relationships among different kinds of entities: Cities connected by roads Computers

More information

Index. stack-based, 400 A* algorithm, 325

Index. stack-based, 400 A* algorithm, 325 Index Abstract transitive closure, 174-175, 217-221 Active vertex, 411 Acyclic graph. See Digraph; Directed acyclic graph (DAG) Acyclic network, 313-321, 334-335 maxflow, 427-429 Adjacency-lists representation,

More information

Some Graph Theory for Network Analysis. CS 249B: Science of Networks Week 01: Thursday, 01/31/08 Daniel Bilar Wellesley College Spring 2008

Some Graph Theory for Network Analysis. CS 249B: Science of Networks Week 01: Thursday, 01/31/08 Daniel Bilar Wellesley College Spring 2008 Some Graph Theory for Network Analysis CS 9B: Science of Networks Week 0: Thursday, 0//08 Daniel Bilar Wellesley College Spring 008 Goals this lecture Introduce you to some jargon what we call things in

More information

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8 CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite

More information

UNDIRECTED GRAPH: a set of vertices and a set of undirected edges each of which is associated with a set of one or two of these vertices.

UNDIRECTED GRAPH: a set of vertices and a set of undirected edges each of which is associated with a set of one or two of these vertices. Graphs 1 Graph: A graph G = (V, E) consists of a nonempty set of vertices (or nodes) V and a set of edges E. Each edge has either one or two vertices associated with it, called its endpoints. An edge is

More information

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs 2011 Pearson Addison-Wesley. All rights reserved 14 A-1 Terminology G = {V, E} A graph G consists of two sets A set V of vertices, or nodes A set E of edges A subgraph Consists of a subset

More information

Graph. Vertex. edge. Directed Graph. Undirected Graph

Graph. Vertex. edge. Directed Graph. Undirected Graph Module : Graphs Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS E-mail: natarajan.meghanathan@jsums.edu Graph Graph is a data structure that is a collection

More information

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95 Algorithms: Graphs Amotz Bar-Noy CUNY Spring 2012 Amotz Bar-Noy (CUNY) Graphs Spring 2012 1 / 95 Graphs Definition: A graph is a collection of edges and vertices. Each edge connects two vertices. Amotz

More information

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS 1 UNIT I INTRODUCTION CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS 1. Define Graph. A graph G = (V, E) consists

More information

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES DEFINITION OF GRAPH GRAPH THEORY Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each

More information

Compatible circuits in eulerian digraphs

Compatible circuits in eulerian digraphs Compatible circuits in eulerian digraphs James Carraher University of Nebraska Lincoln s-jcarrah1@math.unl.edu Joint Work with Stephen Hartke March 2012 James Carraher (UNL) Compatible circuits in eulerian

More information

Algorithm Design (8) Graph Algorithms 1/2

Algorithm 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 information

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Math 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 information

Today s Outline. CSE 326: Data Structures. Topic #15: Cool Graphs n Pretty Pictures. A Great Mathematician. The Bridges of Königsberg

Today 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 information

Chapter 14 Section 3 - Slide 1

Chapter 14 Section 3 - Slide 1 AND Chapter 14 Section 3 - Slide 1 Chapter 14 Graph Theory Chapter 14 Section 3 - Slide WHAT YOU WILL LEARN Graphs, paths and circuits The Königsberg bridge problem Euler paths and Euler circuits Hamilton

More information

Graphs: basic concepts and algorithms

Graphs: basic concepts and algorithms : basic concepts and algorithms Topics covered by this lecture: - Reminder Trees Trees (in-order,post-order,pre-order) s (BFS, DFS) Denitions: Reminder Directed graph (digraph): G = (V, E), V - vertex

More information

CMSC 380. Graph Terminology and Representation

CMSC 380. Graph Terminology and Representation CMSC 380 Graph Terminology and Representation GRAPH BASICS 2 Basic Graph Definitions n A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. n Each edge is a pair (v,w)

More information

Eulerian circuits with no monochromatic transitions

Eulerian circuits with no monochromatic transitions Eulerian circuits with no monochromatic transitions James Carraher University of Nebraska Lincoln s-jcarrah1@math.unl.edu Joint Work with Stephen Hartke June 2012 James Carraher (UNL) Eulerian circuits

More information

BIL694-Lecture 1: Introduction to Graphs

BIL694-Lecture 1: Introduction to Graphs BIL694-Lecture 1: Introduction to Graphs Lecturer: Lale Özkahya Resources for the presentation: http://www.math.ucsd.edu/ gptesler/184a/calendar.html http://www.inf.ed.ac.uk/teaching/courses/dmmr/ Outline

More information

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas Euler and Hamilton paths Jorge A. Cobb The University of Texas at Dallas 1 Paths and the adjacency matrix The powers of the adjacency matrix A r (with normal, not boolean multiplication) contain the number

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 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 information

Eulerian tours. Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck. April 20, 2016

Eulerian tours. Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck.  April 20, 2016 Eulerian tours Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck http://cseweb.ucsd.edu/classes/sp16/cse21-bd/ April 20, 2016 Seven Bridges of Konigsberg Is there a path that crosses each

More information

The Konigsberg Bridge Problem

The Konigsberg Bridge Problem The Konigsberg Bridge Problem This is a classic mathematical problem. There were seven bridges across the river Pregel at Königsberg. Is it possible to take a walk in which each bridge is crossed exactly

More information

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise. Final exam This is a closed book exam. No calculators are allowed. Unless stated otherwise, justify all your steps. You may use lemmas and theorems that were proven in class and on assignments unless stated

More information

Computational Optimization ISE 407. Lecture 19. Dr. Ted Ralphs

Computational Optimization ISE 407. Lecture 19. Dr. Ted Ralphs Computational Optimization ISE 407 Lecture 19 Dr. Ted Ralphs ISE 407 Lecture 19 1 Search Algorithms Search algorithms are fundamental techniques applied to solve a wide range of optimization problems.

More information

Varying Applications (examples)

Varying 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 information

15-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 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 information

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7 CS 70 Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7 An Introduction to Graphs A few centuries ago, residents of the city of Königsberg, Prussia were interested in a certain problem.

More information

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS DR. ANDREW SCHWARTZ, PH.D. 10.1 Graphs and Graph Models (1) A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes)

More information

Chapter 4. Relations & Graphs. 4.1 Relations. Exercises For each of the relations specified below:

Chapter 4. Relations & Graphs. 4.1 Relations. Exercises For each of the relations specified below: Chapter 4 Relations & Graphs 4.1 Relations Definition: Let A and B be sets. A relation from A to B is a subset of A B. When we have a relation from A to A we often call it a relation on A. When we have

More information

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402 Graphs (MTAT.05.080, 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402 homepage: http://courses.cs.ut.ee/2012/graafid (contains slides) For grade: Homework + three tests (during or after

More information

Design and Analysis of Algorithms

Design 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 information

UNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list

UNIT 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 information

Eulerian Paths and Cycles

Eulerian Paths and Cycles Eulerian Paths and Cycles What is a Eulerian Path Given an graph. Find a path which uses every edge exactly once. This path is called an Eulerian Path. If the path begins and ends at the same vertex, it

More information

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4) S-72.2420/T-79.5203 Basic Concepts 1 S-72.2420/T-79.5203 Basic Concepts 3 Characterizing Graphs (1) Characterizing Graphs (3) Characterizing a class G by a condition P means proving the equivalence G G

More information

Chapter 1 Graph Theory

Chapter 1 Graph Theory Chapter Graph Theory - Representations of Graphs Graph, G=(V,E): It consists of the set V of vertices and the set E of edges. If each edge has its direction, the graph is called the directed graph (digraph).

More information

Graphs. Introduction To Graphs: Exercises. Definitions:

Graphs. Introduction To Graphs: Exercises. Definitions: Graphs Eng.Jehad Aldahdooh Introduction To Graphs: Definitions: A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated

More information

Graph Theory. Part of Texas Counties.

Graph Theory. Part of Texas Counties. Graph Theory Part of Texas Counties. We would like to visit each of the above counties, crossing each county only once, starting from Harris county. Is this possible? This problem can be modeled as a graph.

More information

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2 Graph Theory S I I S S I I S Graphs Definition A graph G is a pair consisting of a vertex set V (G), and an edge set E(G) ( ) V (G). x and y are the endpoints of edge e = {x, y}. They are called adjacent

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

An Introduction to Graph Theory

An Introduction to Graph Theory An Introduction to Graph Theory Evelyne Smith-Roberge University of Waterloo March 22, 2017 What is a graph? Definition A graph G is: a set V (G) of objects called vertices together with: a set E(G), of

More information

Graphs. Outline. Definitions Graph implementation as data structure Visiting algorithms C implementations

Graphs. Outline. Definitions Graph implementation as data structure Visiting algorithms C implementations Graphs Outline Definitions Graph implementation as data structure Visiting algorithms C implementations Directed Graph Directed graph G (also called digraph) is a pair (V,E), where V is the (finite) set

More information

DNA Sequencing. Overview

DNA Sequencing. Overview BINF 3350, Genomics and Bioinformatics DNA Sequencing Young-Rae Cho Associate Professor Department of Computer Science Baylor University Overview Backgrounds Eulerian Cycles Problem Hamiltonian Cycles

More information

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V)

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V) Graph Algorithms Graphs Graph G = (V, E) V = set of vertices E = set of edges (V V) Types of graphs Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.) Directed: (u, v) is edge from

More information

Homework 6 Solutions CS330 Discrete Structures, Fall 2017

Homework 6 Solutions CS330 Discrete Structures, Fall 2017 Homework 6 Solutions CS330 Discrete Structures, Fall 2017 Instructor: Professor Edward Reingold TA: Jiahui Hou, Haohua Du Solutions 1. 10 pts) Algorithm 1 Basic Euler Circuit Algorithm. procedure Euler(G

More information

Module 2: NETWORKS AND DECISION MATHEMATICS

Module 2: NETWORKS AND DECISION MATHEMATICS Further Mathematics 2017 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks Key knowledge the conventions, terminology, properties and types of graphs; edge, face, loop,

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Graph theory G. Guérard Department of Nouvelles Energies Ecole Supérieur d Ingénieurs Léonard de Vinci Lecture 1 GG A.I. 1/37 Outline 1 Graph theory Undirected and directed graphs

More information

Elementary Graph Algorithms CSE 6331

Elementary Graph Algorithms CSE 6331 Elementary Graph Algorithms CSE 6331 Reading Assignment: Chapter 22 1 Basic Depth-First Search Algorithm procedure Search(G = (V, E)) // Assume V = {1, 2,..., n} // // global array visited[1..n] // visited[1..n]

More information

Maximum Flows of Minimum Cost

Maximum Flows of Minimum Cost Maximum Flows of Minimum Cost Figure 8-24 Two possible maximum flows for the same network Data Structures and Algorithms in Java 1 Maximum Flows of Minimum Cost (continued) Figure 8-25 Finding a maximum

More information

1. Graph and Representation

1. Graph and Representation Chapter Graphs Tree Root Direction: parent-child relationships No cycles Graph Vertices + Edges No tree restrictions Examples World Wide Web Maps. Graph and Representation A graph G: a pair (V, E) vertices

More information

Chapter 3: Paths and Cycles

Chapter 3: Paths and Cycles Chapter 3: Paths and Cycles 5 Connectivity 1. Definitions: Walk: finite sequence of edges in which any two consecutive edges are adjacent or identical. (Initial vertex, Final vertex, length) Trail: walk

More information

Graphs and Trees. An example. Graphs. Example 2

Graphs and Trees. An example. Graphs. Example 2 Graphs and Trees An example How would you describe this network? What kind of model would you write for it? What kind of information would you expect to obtain? Relationship between some of the apoptotic

More information

Compatible circuits in eulerian digraphs

Compatible circuits in eulerian digraphs Compatible circuits in eulerian digraphs James Carraher University of Nebraska Lincoln s-jcarrah1@math.unl.edu Joint Work with Stephen Hartke March 2012 James Carraher (UNL) Compatible circuits in eulerian

More information