Concepts of Computation

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Chapter 9 Graphs.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Graph Colouring Lecture 20: Nov 25.
1 Separator Theorems for Planar Graphs Presented by Shira Zucker.
Drawing of G. Planar Embedding of G Proposition Proof. 1. Consider a drawing of K 5 or K 3,3 in the plane. Let C be a spanning cycle. 2. If the.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
GRAPH Learning Outcomes Students should be able to:
Planar Graphs: Euler's Formula and Coloring Graphs & Algorithms Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
V Spanning Trees Spanning Trees v Minimum Spanning Trees Minimum Spanning Trees v Kruskal’s Algorithm v Example Example v Planar Graphs Planar Graphs v.
Basic Notions on Graphs. The House-and-Utilities Problem.
Planar Graphs Graph Coloring
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
COSC 2007 Data Structures II Chapter 14 Graphs I.
Graph.
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
1.5 Graph Theory. Graph Theory The Branch of mathematics in which graphs and networks are used to solve problems.
An Introduction to Graph Theory
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Graph Theory and Applications
Prims Algorithm for finding a minimum spanning tree
Graph Concepts and Algorithms Using LEDA By Caroline Moore and Carmen Frerichs (252a-at and 252a-ao) each graph in the presentation was created using gw_basic_graph_algorithms.
1) Find and label the degree of each vertex in the graph.
COMPSCI 102 Introduction to Discrete Mathematics.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Graph Search Applications, Minimum Spanning Tree
Planar Graphs Hubert Chan (Chapter 9.7) [O2 Proof Techniques]
CS 201: Design and Analysis of Algorithms
CSNB 143 Discrete Mathematical Structures
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Chapter 5 : Trees.
Redraw these graphs so that none of the line intersect except at the vertices B C D E F G H.
Great Theoretical Ideas In Computer Science
Graph Theory CSRU1400, Fall 2007 Ellen Zhang.
CSE 373, Copyright S. Tanimoto, 2001 Graphs 1 -
Chapter 5 Fundamental Concept
Applied Combinatorics, 4th Ed. Alan Tucker
Graph theory Definitions Trees, cycles, directed graphs.
Agenda Lecture Content: Introduction to Graph Path and Cycle
Great Theoretical Ideas in Computer Science
Discrete Mathematics for Computer Science
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Graph.
Graphs Chapter 13.
CSE 373, Copyright S. Tanimoto, 2002 Graphs 1 -
Chapter 9: Graphs Basic Concepts
Trees.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Applied Combinatorics, 4th Ed. Alan Tucker
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
A Introduction to Computing II Lecture 13: Trees
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
CSE 373: Data Structures and Algorithms
Planarity.
Miniconference on the Mathematics of Computation
N(S) ={vV|uS,{u,v}E(G)}
Discrete Mathematics for Computer Science
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
HW 3 (Due Wednesday Feb 6) Create slide(s) for your 1 minute presentation on a graph theory application. Make sure your slide(s) include (1) Define the.
Chapter 9: Graphs Basic Concepts
Concepts of Computation
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Concepts of Computation
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Minimum Spanning Trees
Presentation transcript:

Concepts of Computation Session 8b Graphs Dr Oded Lachish Email: oded@dcs.bbk.ac.uk (Slides prepared with the support of Dr Paul Newman and Eva Szatmari)

Graphs Graphs Connected Component Special types of graphs Planar graphs Directed graphs Trees Minimum Spanning Tree

Connected component of a graph A connected component of a graph is an induced subgraph H such that there is a path between every two vertices in H and there does not exists a path in G between any vertex in H and vertex not in H. In the example on the right, the connected components are H1, H2,H3, H4, and H5 . G (all the vertices below) H1 H2 H3 H4 H5

Special graphs A graph is complete if each vertex is connected to every other vertex. The complete graph with n vertices is denoted Kn A graph or multigraph is k-regular (or regular of degree k) is every vertex has degree k

Complete Graph examples K1 K2 K3 K4 K5

k-regular graphs 0-regular 1-regular 2-regular 3-regular

Bipartite Graphs In a bipartite graph G, the vertex set V is partitioned into two subsets subsets (say S and T ) Every edge in the graph is adjacent to a vertex in S and to a vertex in T A complete bipartite graph means that every vertex in S is connected to each vertex in T. We use the notation Km,n, two denote the bipartite graph with vertex sets S and T such that |S|=m and |T|=n.

Bipartite Graph examples K1,3 K2,3 K3,1 non-complete

Planar Graphs A graph which can be drawn on a plane such that no edges cross each other is called a Planar graph. A particular representation of a planar graph is called a Map. Example: The “can” is emphasized, because seeing a drawing of a graph that is not planar, doesn’t mean that the graph does not have one and hence is not planar. K5 and K3,3 are not planar. If your not convinced, try to prove this is wrong, by drawing it on a plane without crossing edges

Maps R1 R2 R3 A map divides the plane into various regions. In the example below there is one region in each triangle and all the area outside is also considered a region. R1 R2 R3

Maps R1 R2 R3 A map divides the plane into various regions. Euler’s formula: Connected map: |V| – |E| + |R| = 2 Disconnected map: |V| – |E| + |R| = k + 1 V = set of Vertices, E = set of Edges, R = set of Regions, k = no. of connected components R1 R2 R3

Map Examples Connected Map R1 R2 R3 Disconnected Map R1 R2 R3 |V| = 6, |E| = 7, |R| = 3, |V| – |E| + |R| = 2 => 6 – 7 + 3 = 2 |V| = 6, |E| = 6, |R| = 3, k=2, |V| – |E| + |R| = k+1 => 6 – 6 + 3 = 1+2

Labelled graph example v2 v3 v4 2 2 1 3 2 3 1 2 4 1 5 v0 v1 v8 2 4 v5 3 v6 5 v7 May be important to find the path of least weight.

Tree graphs A graph is acyclic or cycle-free if it contains no cycles. A connected, acyclic graph is called a tree. Generally, a forest is a disconnected acyclic graph (but it can also consist of a single tree or an empty graph). The connected subgraphs of a forest are trees.

Tree examples All the trees with six vertices, together they are a forest.

Rooted tree A tree with a designated vertex r, called the root of the tree, is a rooted tree R. The length of the path, from r to any vertex v, is called the level, depth or generation of v. The endpoints of R are called the leaves of R, the path from r to a leaf is a branch. Any tree can be made into a rooted tree by picking a vertex to be the root.

Rooted Tree example a r b e c d h i j f g l m k

Spanning trees For a graph G, the sub-graph T is called at spanning tree if it contains all the vertices of G. We used dashed lines to for the edges of the spanning tree. Note that they indeed form a tree

Labelled graphs A graph G, is called a labelled graph if edges and/or vertices are assigned data. If each edge e, of G is assigned a number l(e) greater or equal to 0, then l(e) is called the weight or length of e.

Minimum spanning tree If the graph G has weighted edges, then a minimal spanning tree of G is that spanning tree with the least weight of the edges. The spanning tree formed by the dashed lines is a minimal spanning tree. Any other spanning tree must have one of the edges with weight larger than 1, and the weight of the minimum spanning tree, which is 4. Can we easily find a spanning tree? Yes! 1 23 22 21 24

Finding a minimum Spanning Tree Pick one edge with the smallest weight We picked an edge of weight 1. There are two, this works regardless which edge we took. The edge is marked by a dashed line 1 2 5 3 4

Finding a minimum Spanning Tree Before choice 2 2 2. Pick one edge with the smallest weight amongst the edges that share exactly one vertex with the edges we already chose The edges to choose from are dotted We picked an edge of weight 2, because it had the smallest weight amongst the dotted ones The before and after are illustrated on the right 3 1 2 4 1 5 2 5 After choice 2 2 3 1 2 4 1 5 2 5

Finding a minimum Spanning Tree Before choice 2 2 3. Pick one edge with the smallest weight amongst the edges that share exactly one vertex with the edges we already chose The edges to choose from are dotted We picked one of edges of weight 2, because it had the smallest weight amongst the dotted ones (there are two. This would still work if we picked the other.) 3 1 2 4 1 5 3 5 After choice 2 2 3 1 2 4 1 5 2 5

Finding a minimum Spanning Tree Before choice 2 2 4. Pick one edge with the smallest weight amongst the edges that share exactly one vertex with the edges we already chose We picked one of edges of weight 2, because it had the smallest weight amongst the dotted ones We notice, the we ignored the edges that share both vertices with edges that we already selected. We notice that these edges together with the ones already selected create a cycle. Meaning that if we chose them we wouldn’t have a tree. 3 1 2 4 1 5 2 5 After choice 2 2 3 1 2 4 1 5 2 5

Finding a minimum Spanning Tree Before choice 2 2 5. Pick one edge with the smallest weight amongst the edges that share exactly one vertex with the edges we already chose We picked one of edges of weight 1, because it had the smallest weight amongst the dotted ones Now all the edges we selected are those of a spanning tree, because it is connected has no cycles and has all the vertices of the graph. So we are done. The total weight is 1+2+2+2+1 = 8 3 1 2 4 1 5 2 5 After choice 2 2 3 1 2 4 1 5 2 5

Finding a minimum spanning tree The only thing we did was one initial step and then repeat the same step again and again until we had a spanning tree. Pick one edge with the smallest weight amongst the edges Select one edge with the smallest weight amongst the edges that share exactly one vertex with the edges we already chose Lets try a different order on the same example

Finding a minimum spanning tree Step 1 Step 3 Step 5 2 2 2 2 1 2 5 3 4 3 3 4 4 1 2 1 1 2 1 5 5 2 5 2 5 2 2 2 2 3 3 Step 2 4 4 1 2 1 1 2 1 1 2 5 3 4 5 5 2 5 2 5 Step 4 2 2 The weight of the spanning tree is 1+2+2+2+1 = 8 We notice that it is not the same spanning tree as in the previous time 3 2 2 4 1 2 1 5 3 4 1 2 1 2 5 5 2 2 2 5 3 4 1 2 1 5 2 5