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

Size: px
Start display at page:

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

Transcription

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

2 What can graphs model? Cost of wiring electronic components together. Shortest route between two cities. Finding the shortest distance between all pairs of cities in a road atlas. Flow of material (liquid flowing through pipes, current through electrical networks, information through communication networks, parts through an assembly line, etc). State of a machine (FSM). Used in Operating systems to model resource handling (deadlock problems). Used in compilers for parsing and optimizing the code. 2 Czech University of Life Sciences

3 What is a Graph? Informally a graph is a set of nodes joined by a set of lines or arrows Czech University of Life Sciences

4 A directed graph, also called a digraph G is a pair ( V, E ), where the set V is a finite set and E is a binary relation on V. The set V is called the vertex set of G and the elements are called vertices. The set E is called the edge set of G and the elements are edges (also called arcs ). A edge from node a to node b is denoted by the ordered pair ( a, b ). Self loop Isolated node V = {, 2, 3, 4, 5, 6, 7 } V = 7 E = { (,2), (2,2), (2,4), (4,5), (4,), (5,4),(6,3) } E = 7 4 Czech University of Life Sciences

5 An undirected graph G = ( V, E ), but unlike a digraph the edge set E consist of unordered pairs. We use the notation (a, b ) to refer to a directed edge, and { a, b } for an undirected edge. A B C V = { A, B, C, D, E, F } V = 6 D E F E = { {A, B}, {A,E}, {B,E}, {C,F} } E = 4 Some texts use (a, b) also for undirected edges. So ( a, b ) and ( b, a ) refers to the same edge. 5 Czech University of Life Sciences

6 Degree of a Vertex in an undirected graph is the number of edges incident on it. In a directed graph, the out degree of a vertex is the number of edges leaving it and the in degree is the number of edges entering it. A B C The degree of B is 2. D E F Self-loop 2 The in degree of 2 is 2 and the out degree of 2 is Czech University of Life Sciences

7 Simple Graphs Simple graphs are graphs without multiple edges or self-loops. We will consider only simple graphs. Proposition: If G is an undirected graph then Σ deg(v) = 2 E v G Proposition: If G is a digraph then Σ indeg(v) = Σ outdeg(v) = E v G v G 7 Czech University of Life Sciences

8 A weighted graph is a graph for which each edge has an associated weight, usually given by a weight function w: E R Czech University of Life Sciences

9 A path is a sequence of vertices such that there is an edge from each vertex to its successor. A path from a vertex to itself is called a cycle. A graph is called cyclic if it contains a cycle; otherwise it is called acyclic A path is simple if each vertex is distinct. 2 3 A B C Cycle D E F Cycle Simple path from to 5 = (, 2, 4, 5 ) or as in our text ((, 2), (2, 4), (4,5)) Unreachable If there is path p from u to v then we say v is reachable from u via p. 9 Czech University of Life Sciences

10 Walks and Paths V 2 3 V 3 2 V 3 V V 4 A walk is an sequence of nodes (v, v 2,..., v L ) such that {(v, v 2 ), (v, v 2 ),..., (v, v 2 )} E, e.g. (V 2, V 3,V 6, V 5,V 3 ) A simplepath is a walk with no repeated nodes, e.g. (V, V 4,V 5, V 2,V 3 ) A cycle is an walk (v, v 2,..., v L ) where v =v L with no other nodes repeated and L>3, e.g. (V, V 2,V 5, V 4,V ) A graph is called cyclic if it contains a cycle; otherwise it is called acyclic 0 Czech University of Life Sciences V 5

11 A Complete graph is an undirected/directed graph in which every pair of vertices is adjacent. If (u, v ) is an edge in a graph G, we say that vertex v is adjacent to vertex u. A B A B E D 4 nodes and (4*3)/2 edges V nodes and V*(V-)/2 edges Note: if self loops are allowed V(V- )/2 +Vedges D 3 nodes and 3*2 edges V nodes and V*(V-) edges Note: if self loops are allowed V 2 edges Czech University of Life Sciences

12 An undirected graph is connected if you can get from any node to any other by following a sequence of edges OR any two nodes are connected by a path. In an undirected graph, a connected component is a maximal connected subgraph. Adirected graph is strongly connected if there is a directed path from any node to any other node. In a directed graph, a strongly connected component is a maximal strongly connected subgraph. An undirected graph with 3 components 2 Czech University of Life Sciences

13 Planar Graphs cut-set: a subset of edges whose removal increase the number of components a Ex..2 b d e f h cut-sets: {(a,b),(a,c)}, {(b,d),(c,d)},{(d,f)},... c a bridge g For planar graphs, cycles in one graph correspond to cut-sets in a dual graphs and vice versa. 3 Czech University of Life Sciences

14 A bipartite graph is an undirected graph G = (V,E) in which V can be partitioned into 2 sets V and V 2 such that ( u,v) E implies either u V and v V 2 OR v V and u V 2. 4 Czech University of Life Sciences

15 Graphs: Subgraphs A graph G (V,E ) is a subgraph of the graph G(V,E) if V V and E E. Note that this does require G (V,E ) to be a graph, so one cannot form a subgraph of arbitrary subsets of V and E. The second graph below is a subset of the first. a b a b c d c 5 Czech University of Life Sciences

16 A free tree is an acyclic, connected, undirected graph. A forest is an acyclic undirected graph. A rooted tree is a tree with one distinguished node, root. Let G = (V, E ) be an undirected graph. The following statements are equivalent.. G is a tree 2. Any two vertices in G are connected by unique simple path. 3. G is connected, but if any edge is removed from E, the resulting graph is disconnected. 4. G is connected, and E = V - 5. G is acyclic, and E = V - 6. G is acyclic, but if any edge is added to E, the resulting graph contains a cycle. 6 Czech University of Life Sciences

17 Spanning Tree Spanning tree T of a connected, undirected graph G is a tree composed of all the vertices and some (or perhaps all) of the edges of G. Informally, a spanning tree of G is a selection of edges of G that form a tree spanning every vertex. That is, every vertex lies in the tree, but no cycles (or loops) are formed. On the other hand, every bridge of G must belong to T. A spanning tree of a connected graph G can also be defined as a maximal set of edges of G that contains no cycle, or as a minimal set of edges that connect all vertices. 7 Czech University of Life Sciences

18 Implementation of a Graph. Adjacency-list representation of a graph G = ( V, E ) consists of an array ADJ of V lists, one for each vertex in V. For each u V, ADJ [ u ] points to all its adjacent vertices Czech University of Life Sciences

19 Adjacency-list representation for a directed graph Variation: Can keep a second list of edges coming into a vertex. 9 Czech University of Life Sciences

20 Adjacency lists Advantage: Saves space for sparse graphs. Most graphs are sparse. Visit edges that start at v Must traverse linked list of v Size of linked list of v is degree(v) θ(degree(v)) Disadvantage: Check for existence of an edge (v, u) Must traverse linked list of v Size of linked list of v is degree(v) θ(degree(v)) 20 Czech University of Life Sciences

21 Adjacency List Storage We need V pointers to linked lists For a directed graph the number of nodes (or edges) contained (referenced) in all the linked lists is Σ(out-degree (v)) = E. So we need Θ( V + E) v V For an undirected graph the number of nodes is Σ(degree (v)) = 2 E Also Θ( V + E) v V 2 Czech University of Life Sciences

22 Adjacency-matrix-representation of a graph G = ( V, E) is a V x V matrix A = ( a ij ) such that a ij = (or some Object) if (i, j ) E and 0 (or null) otherwise Czech University of Life Sciences

23 Adjacency Matrix Representation for a Directed Graph Czech University of Life Sciences

24 Adjacency Matrix Representation Advantage: Saves space on pointers for dense graphs, and on small unweighted graphs using bit per edge. Check for existence of an edge (v, u) (adjacency [i] [j]) == true?) So θ() Disadvantage: visit all the edges that start at v Row v of the matrix must be traversed. So θ( V ). 24 Czech University of Life Sciences

25 Adjacency Matrix Representation Storage Θ( V 2 ) ( We usually just write, Θ( V 2 ) ) For undirected graphs you can save storage (only /2(V 2 )) by noticing the adjacency matrix of an undirected graph is symmetric. Need to update code to work with new representation. Gain in space is offset by increase in the time required by the methods. 25 Czech University of Life Sciences

Review: Graph Theory and Representation

Review: Graph Theory and Representation Review: Graph Theory and Representation Graph Algorithms Graphs and Theorems about Graphs Graph implementation Graph Algorithms Shortest paths Minimum spanning tree What can graphs model? Cost of wiring

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

Graphs Definitions. Gunnar Gotshalks. GraphDefinitions 1

Graphs Definitions. Gunnar Gotshalks. GraphDefinitions 1 Graphs Definitions GraphDefinitions 1 Examples of Graphs Street maps» Vertices are the intersections» Edges are the streets Power line network» Vertices are the houses & power stations» Edges are the power

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

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

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

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

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

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

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

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

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

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

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

Lecture 1: Examples, connectedness, paths and cycles

Lecture 1: Examples, connectedness, paths and cycles Lecture 1: Examples, connectedness, paths and cycles Anders Johansson 2011-10-22 lör Outline The course plan Examples and applications of graphs Relations The definition of graphs as relations Connectedness,

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

Graphs, graph algorithms (for image segmentation),... in progress

Graphs, graph algorithms (for image segmentation),... in progress Graphs, graph algorithms (for image segmentation),... in progress Václav Hlaváč Czech Technical University in Prague Czech Institute of Informatics, Robotics and Cybernetics 66 36 Prague 6, Jugoslávských

More information

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University Graphs: Introduction Ali Shokoufandeh, Department of Computer Science, Drexel University Overview of this talk Introduction: Notations and Definitions Graphs and Modeling Algorithmic Graph Theory and Combinatorial

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

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

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

CS 561, Lecture 9. Jared Saia University of New Mexico

CS 561, Lecture 9. Jared Saia University of New Mexico CS 561, Lecture 9 Jared Saia University of New Mexico Today s Outline Minimum Spanning Trees Safe Edge Theorem Kruskal and Prim s algorithms Graph Representation 1 Graph Definition A graph is a pair of

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

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

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

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

Lesson 22: Basic Graph Concepts

Lesson 22: Basic Graph Concepts Lesson 22: asic Graph oncepts msc 175 iscrete Mathematics 1. Introduction graph is a mathematical object that is used to model different relations between objects and processes: Linked list Flowchart of

More information

Basic Graph Definitions

Basic Graph Definitions CMSC 341 Graphs Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. Each edge is a pair (v,w) where v, w V. V and E are sets, so each vertex

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

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge. 1 Graph Basics What is a graph? Graph: a graph G consists of a set of vertices, denoted V (G), a set of edges, denoted E(G), and a relation called incidence so that each edge is incident with either one

More information

7.3 Spanning trees Spanning trees [ ] 61

7.3 Spanning trees Spanning trees [ ] 61 7.3. Spanning trees [161211-1348 ] 61 7.3 Spanning trees We know that trees are connected graphs with the minimal number of edges. Hence trees become very useful in applications where our goal is to connect

More information

Directed Graph and Binary Trees

Directed Graph and Binary Trees and Dr. Nahid Sultana December 19, 2012 and Degrees Paths and Directed graphs are graphs in which the edges are one-way. This type of graphs are frequently more useful in various dynamic systems such as

More information

Definition of Graphs and Trees. Representation of Trees.

Definition of Graphs and Trees. Representation of Trees. Definition of Graphs and Trees. Representation of Trees. Chapter 6 Definition of graphs (I) A directed graph or digraph is a pair G = (V,E) s.t.: V is a finite set called the set of vertices of G. E V

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Lecturer: Mgr. Tereza Kovářová, Ph.D. tereza.kovarova@vsb.cz Guarantor: doc. Mgr. Petr Kovář, Ph.D. Department of Applied Mathematics, VŠB Technical University of Ostrava About this

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

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

Number Theory and Graph Theory

Number Theory and Graph Theory 1 Number Theory and Graph Theory Chapter 6 Basic concepts and definitions of graph theory By A. Satyanarayana Reddy Department of Mathematics Shiv Nadar University Uttar Pradesh, India E-mail: satya8118@gmail.com

More information

Graphs. 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 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 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: Introduction

Graph Theory: Introduction Graph Theory: Introduction Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT Kharagpur pallab@cse.iitkgp.ernet.in Resources Copies of slides available at: http://www.facweb.iitkgp.ernet.in/~pallab

More information

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

SCHOOL 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 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

Course Introduction / Review of Fundamentals of Graph Theory

Course Introduction / Review of Fundamentals of Graph Theory Course Introduction / Review of Fundamentals of Graph Theory Hiroki Sayama sayama@binghamton.edu Rise of Network Science (From Barabasi 2010) 2 Network models Many discrete parts involved Classic mean-field

More information

Lecture 22 Tuesday, April 10

Lecture 22 Tuesday, April 10 CIS 160 - Spring 2018 (instructor Val Tannen) Lecture 22 Tuesday, April 10 GRAPH THEORY Directed Graphs Directed graphs (a.k.a. digraphs) are an important mathematical modeling tool in Computer Science,

More information

Chapter 11: Graphs and Trees. March 23, 2008

Chapter 11: Graphs and Trees. March 23, 2008 Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a

More information

Lecture 10. Graphs Vertices, edges, paths, cycles Sparse and dense graphs Representations: adjacency matrices and adjacency lists Implementation notes

Lecture 10. Graphs Vertices, edges, paths, cycles Sparse and dense graphs Representations: adjacency matrices and adjacency lists Implementation notes Lecture 10 Graphs Vertices, edges, paths, cycles Sparse and dense graphs Representations: adjacency matrices and adjacency lists Implementation notes Reading: Weiss, Chapter 9 Page 1 of 24 Midterm exam

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

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

Introduction to Graphs

Introduction to Graphs Graphs Introduction to Graphs Graph Terminology Directed Graphs Special Graphs Graph Coloring Representing Graphs Connected Graphs Connected Component Reading (Epp s textbook) 10.1-10.3 1 Introduction

More information

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

Graphs and Genetics. Outline. Computational Biology IST. Ana Teresa Freitas 2015/2016. Slides source: AED (MEEC/IST); Jones and Pevzner (book) 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

More information

Graph Algorithms: Chapters Part 1: Introductory graph concepts

Graph Algorithms: Chapters Part 1: Introductory graph concepts UMass Lowell Computer Science 91.503 Algorithms Dr. Haim Levkowitz Fall, 2007 Graph Algorithms: Chapters 22-25 Part 1: Introductory graph concepts 1 91.404 Graph Review Elementary Graph Algorithms Minimum

More 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

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

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

Introductory Remarks

Introductory Remarks Chapter 8: Graphs Introductory Remarks Although trees are quite flexible, they have an inherent limitation in that they can only express hierarchical structures Fortunately, we can generalize a tree to

More information

CSI 604 Elementary Graph Algorithms

CSI 604 Elementary Graph Algorithms CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the

More 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

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1 CS200: Graphs Prichard Ch. 14 Rosen Ch. 10 CS200 - Graphs 1 Graphs A collection of nodes and edges What can this represent? n A computer network n Abstraction of a map n Social network CS200 - Graphs 2

More information

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10 CS 220: Discrete Structures and their Applications graphs zybooks chapter 10 directed graphs A collection of vertices and directed edges What can this represent? undirected graphs A collection of vertices

More information

Review of Graph Theory. Gregory Provan

Review of Graph Theory. Gregory Provan Review of Graph Theory Gregory Provan Overview Need for graphical models of computation Cloud computing Data centres Telecommunications networks Graph theory Graph Models for Cloud Computing Integration

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

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

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

Elementary Graph Algorithms

Elementary Graph Algorithms Elementary 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)

More information

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees Administrivia Lecture 3: Recap Assignment 1 due 23:59 tomorrow. Quiz 4 up tonight, due 15:00 Thursday 31 August. Equivalence relations: (S), (R), (T) Total orders: (AS), (R), (T), (L) Partial orders: (AS),

More information

Graphs. Data Structures and Algorithms CSE 373 SU 18 BEN JONES 1

Graphs. Data Structures and Algorithms CSE 373 SU 18 BEN JONES 1 Graphs Data Structures and Algorithms CSE 373 SU 18 BEN JONES 1 Warmup Discuss with your neighbors: Come up with as many kinds of relational data as you can (data that can be represented with a graph).

More information

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1 Undirected Graphs Terminology. Free Trees. Representations. Minimum Spanning Trees (algorithms: Prim, Kruskal). Graph Traversals (dfs, bfs). Articulation points & Biconnected Components. Graph Matching

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

Undirected Graphs. Hwansoo Han

Undirected Graphs. Hwansoo Han Undirected Graphs Hwansoo Han Definitions Undirected graph (simply graph) G = (V, E) V : set of vertexes (vertices, nodes, points) E : set of edges (lines) An edge is an unordered pair Edge (v, w) = (w,

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

Discrete Structures CISC 2315 FALL Graphs & Trees

Discrete Structures CISC 2315 FALL Graphs & Trees Discrete Structures CISC 2315 FALL 2010 Graphs & Trees Graphs A graph is a discrete structure, with discrete components Components of a Graph edge vertex (node) Vertices A graph G = (V, E), where V is

More information

Graphs. Motivations: o Networks o Social networks o Program testing o Job Assignment Examples: o Code graph:

Graphs. Motivations: o Networks o Social networks o Program testing o Job Assignment Examples: o Code graph: Graphs Motivations: o Networks o Social networks o Program testing o Job Assignment Examples: o Code graph: S1: int x S2: If x > 0 then S3: X = x + 2; Else S4: X =x -1; End if S5: While x > 1 do S6: Print

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

COT 6405 Introduction to Theory of Algorithms

COT 6405 Introduction to Theory of Algorithms COT 6405 Introduction to Theory of Algorithms Topic 14. Graph Algorithms 11/7/2016 1 Elementary Graph Algorithms How to represent a graph? Adjacency lists Adjacency matrix How to search a graph? Breadth-first

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

CSE 101, Winter Discussion Section Week 1. January 8 - January 15

CSE 101, Winter Discussion Section Week 1. January 8 - January 15 CSE 101, Winter 2018 Discussion Section Week 1 January 8 - January 15 Important Annotations were added (post-lecture) to the tablet slides, to fill in a few gaps (Lecture 1) Look through Additional Resources

More information

Graph Overview (1A) Young Won Lim 5/9/18

Graph Overview (1A) Young Won Lim 5/9/18 Copyright (c) 2015 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

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

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

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

Assignment 4 Solutions of graph problems

Assignment 4 Solutions of graph problems Assignment 4 Solutions of graph problems 1. Let us assume that G is not a cycle. Consider the maximal path in the graph. Let the end points of the path be denoted as v 1, v k respectively. If either of

More information

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1 Graph fundamentals Bipartite graph characterization Lemma. If a graph contains an odd closed walk, then it contains an odd cycle. Proof strategy: Consider a shortest closed odd walk W. If W is not a cycle,

More information

Parallel Graph Algorithms

Parallel Graph Algorithms Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050/VT3 Part I Introduction Overview Graphs definitions & representations Minimal Spanning Tree (MST) Prim s algorithm Single Source

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

Graphs Introduction and Depth first algorithm

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

Graphs V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Graphs V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)} Graphs and Trees 1 Graphs (simple) graph G = (V, ) consists of V, a nonempty set of vertices and, a set of unordered pairs of distinct vertices called edges. xamples V={,,,,} ={ (,),(,),(,), (,),(,),(,)}

More information

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered

More information

Module 11. Directed Graphs. Contents

Module 11. Directed Graphs. Contents Module 11 Directed Graphs Contents 11.1 Basic concepts......................... 256 Underlying graph of a digraph................ 257 Out-degrees and in-degrees.................. 258 Isomorphism..........................

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

Paths. Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph.

Paths. Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph. Paths Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph. Formal Definition of a Path (Undirected) Let n be a nonnegative integer

More information

GRAPHS Lecture 19 CS2110 Spring 2013

GRAPHS Lecture 19 CS2110 Spring 2013 GRAPHS Lecture 19 CS2110 Spring 2013 Announcements 2 Prelim 2: Two and a half weeks from now Tuesday, April16, 7:30-9pm, Statler Exam conflicts? We need to hear about them and can arrange a makeup It would

More information

0.0.1 Network Analysis

0.0.1 Network Analysis Graph Theory 0.0.1 Network Analysis Prototype Example: In Algonquian Park the rangers have set up snowmobile trails with various stops along the way. The system of trails is our Network. The main entrance

More information

Data Structure. IBPS SO (IT- Officer) Exam 2017

Data Structure. IBPS SO (IT- Officer) Exam 2017 Data Structure IBPS SO (IT- Officer) Exam 2017 Data Structure: In computer science, a data structure is a way of storing and organizing data in a computer s memory so that it can be used efficiently. Data

More information

IS 709/809: Computational Methods in IS Research. Graph Algorithms: Introduction

IS 709/809: Computational Methods in IS Research. Graph Algorithms: Introduction IS 709/809: Computational Methods in IS Research Graph Algorithms: Introduction Nirmalya Roy Department of Information Systems University of Maryland Baltimore County www.umbc.edu Motivation Several real-life

More information

Chapter 9: Elementary Graph Algorithms Basic Graph Concepts

Chapter 9: Elementary Graph Algorithms Basic Graph Concepts hapter 9: Elementary Graph lgorithms asic Graph oncepts msc 250 Intro to lgorithms graph is a mathematical object that is used to model different situations objects and processes: Linked list Tree (partial

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

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

Minimum Spanning Trees My T. UF

Minimum Spanning Trees My T. UF Introduction to Algorithms Minimum Spanning Trees @ UF Problem Find a low cost network connecting a set of locations Any pair of locations are connected There is no cycle Some applications: Communication

More information

UNIT IV -NON-LINEAR DATA STRUCTURES 4.1 Trees TREE: A tree is a finite set of one or more nodes such that there is a specially designated node called the Root, and zero or more non empty sub trees T1,

More information