Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)

Slides:



Advertisements
Similar presentations
CS 473Lecture 131 CS473-Algorithms I Lecture 13-A Graphs.
Advertisements

Chapter 9 Graphs.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R5. Graphs.
Graph & BFS.
Introduction to Graphs
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Social Media Mining Graph Essentials.
ALG0183 Algorithms & Data Structures Lecture 18 The basics of graphs. 8/25/20091 ALG0183 Algorithms & Data Structures by Dr Andy Brooks.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs CS /02/05 Graphs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Definition.
Introduction to Network Theory: Basic Concepts
Been-Chian Chien, Wei-Pang Yang, and Wen-Yang Lin 6-1 Chapter 6 Graphs Introduction to Data Structure CHAPTER 6 GRAPHS 6.1 The Graph Abstract Data Type.
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
Chapter 2 Graph Algorithms.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
Graphs Chapter 12.
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Data Structures Week 9 Introduction to Graphs Consider the following problem. A river with an island and bridges. The problem is to see if there is a way.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Introduction Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
Data Structures & Algorithms Graphs
Graph A graph G is a set V(G) of vertices (nodes) and a set E(G) of edges which are pairs of vertices. abcd e i fgh jkl V = { a, b, c, d, e, f, g, h, i,
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
COSC 2007 Data Structures II Chapter 14 Graphs I.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
An Introduction to Graph Theory
Graph Theory and Applications
Introduction to Graph Theory
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Homework #5 Due: October 31, 2000 Christine Kang Graph Concepts and Algorithms.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Graphs 황승원 Fall 2010 CSE, POSTECH. 2 2 Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Graphs Upon completion you will be able to:
Graphs Lecture 2. Graphs (1) An undirected graph is a triple (V, E, Y), where V and E are finite sets and Y:E g{X V :| X |=2}. A directed graph or digraph.
Graph Theory Unit: 4.
Chapter 9: Graphs.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Graph Theory Graph Theory - History Leonhard Euler's paper on “Seven Bridges of Königsberg”, published in 1736.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Lecture #13. Topics 1.The Graph Abstract Data Type. 2.Graph Representations. 3.Elementary Graph Operations.
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
Leda Demos By: Kelley Louie Credits: definitions from Algorithms Lectures and Discrete Mathematics with Algorithms by Albertson and Hutchinson graphics.
Subject Four Graphs Data Structures. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes.
CS 201: Design and Analysis of Algorithms
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Graph theory Definitions Trees, cycles, directed graphs.
CS120 Graphs.
CMSC 341 Lecture 21 Graphs (Introduction)
Modeling and Simulation NETW 707
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
Graphs By Rajanikanth B.
Graphs G = (V, E) V are the vertices; E are the edges.
Introduction to Graph Theory
Applied Discrete Mathematics Week 13: Graphs
Presentation transcript:

Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)

What is a Graph? Informally a graph is a set of nodes joined by a set of lines or arrows

Definition: Graph G is an ordered triple G:=(V, E, f) –V is a set of nodes, points, or vertices. –E is a set, whose elements are known as edges or lines. –f is a function maps each element of E to an unordered pair of vertices in V.

Definitions Vertex –Basic Element –Drawn as a node or a dot. –Vertex set of G is usually denoted by V(G), or V Edge –A set of two elements –Drawn as a line connecting two vertices, called end vertices, or endpoints. –The edge set of G is usually denoted by E(G), or E.

Example V:={1,2,3,4,5,6}E:={{1,2},{1,5},{2,3},{2,5},{3,4},{4,5},{4,6}}

Simple Graphs Simple graphs are graphs without multiple edges or self-loops.

Path Cycle Simple path from 1 to 5 = [ 1, 2, 4, 5 ] Our text’s alternates the vertices and edges. A D E F B C Unreachable Cycle If there is path p from u to v then we say v is reachable from u via p. A path is a sequence of vertices such that there is an edge from each vertex to its successor. A path is simple if each vertex is distinct.

Cycle 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 Cycle A D E F B C Unreachable Cycle

Connectivity is connected if 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. A directed graph is strongly connected if there is a directed path from any node to any other node.

Sparse/Dense A graph is sparse if | E |  | V | A graph is dense if | E |  | V | 2.

A weighted graph is a graph for which each edge has an associated weight, usually given by a weight function w: E  R. is a graph for which each edge has an associated weight, usually given by a weight function w: E  R.

Directed Graph (digraph) Edges have directions –An edge is an ordered pair of nodes

Bipartite graph V can be partitioned into 2 sets V 1 and V 2 such that (u,v)  E implies –either u  V 1 and v  V 2 –OR v  V 1 and u  V 2.

Special Types Empty Graph / Edgeless graph –No edge Null graph –No nodes –Obviously no edge

Complete Graph Denoted K n Every pair of vertices are adjacent Has n(n-1) edges

Complete Bipartite Graph Bipartite Variation of Complete Graph Every node of one set is connected to every other node on the other set

Planar Graph Can be drawn on a plane such that no two edges intersect K 4 is the largest complete graph that is planar

Dual Graph Faces are considered as nodes Edges denote face adjacency Dual of dual is the original graph

Tree Connected Acyclic Graph Two nodes have exactly one path between them

Generalization: Hypergraph Generalization of a graph, –edges can connect any number of vertices. Formally, an hypergraph is a pair (X,E) where –X is a set of elements, called nodes or vertices, and –E is a set of subsets of X, called hyperedges. Hyperedges are arbitrary sets of nodes, –contain an arbitrary number of nodes.

Degree Number of edges incident on a node A D E F B C The degree of B is 2.

Degree (Directed Graphs) In degree: Number of edges entering Out degree: Number of edges leaving Degree = indegree + outdegree The in degree of 2 is 2 and the out degree of 2 is 3.

Degree: Simple Facts If G is a digraph with m edges, then  indeg(v) =  outdeg(v) = m = |E | If G is a graph with m edges, then  deg(v) = 2m = 2 |E | –Number of Odd degree Nodes is even

Subgraphs

Subgraph Vertex and edge sets are subsets of those of G –a supergraph of a graph G is a graph that contains G as a subgraph. A graph G contains another graph H if some subgraph of G –is H or –is isomorphic to H. H is a proper subgraph if H!=G

Spanning subgraph Subgraph H has the same vertex set as G. –Possibly not all the edges –“H spans G”.

Induced Subgraph For any pair of vertices x and y of H, xy is an edge of H if and only if xy is an edge of G. –H has the most edges that appear in G over the same vertex set.

Induced Subgraph (2) If H is chosen based on a vertex subset S of V(G), then H can be written as G[S] –“induced by S” A graph that does not contain H as an induced subgraph is said to be H-free

Component Maximum Connected sub graph

Isomorphism

Isomorphism Bijection, i.e., a one-to-one mapping: f : V(G) -> V(H) u and v from G are adjacent if and only if f(u) and f(v) are adjacent in H. If an isomorphism can be constructed between two graphs, then we say those graphs are isomorphic.

Isomorphism Problem Determining whether two graphs are isomorphic Although these graphs look very different, they are isomorphic; one isomorphism between them is f(a) = 1 f(b) = 6 f(c) = 8 f(d) = 3 f(g) = 5 f(h) = 2 f(i) = 4 f(j) = 7

Graph Abstract Data Type

Graph ADT In computer science, a graph is an abstract data type (ADT) that consists of –a set of nodes and –a set of edges establish relationships (connections) between the nodes. The graph ADT follows directly from the graph concept from mathematics.

Representation (Matrix) Incidence Matrix –E x V –[edge, vertex] contains the edge's data Adjacency Matrix –V x V –Boolean values (adjacent or not) –Or Edge Weights

Representation (List) Edge List –pairs (ordered if directed) of vertices –Optionally weight and other data Adjacency List

Implementation of a Graph. Adjacency-list representation –an array of |V | lists, one for each vertex in V. –For each u  V, ADJ [ u ] points to all its adjacent vertices.

Adjacency-list representation for a directed graph Variation: Can keep a second list of edges coming into a vertex.

Adjacency lists Advantage: –Saves space for sparse graphs. Most graphs are sparse. –Traverse all the edges that start at v, in  (degree(v)) Disadvantage: –Check for existence of an edge (v, u) in worst case time  (degree(v))

Adjacency List Storage –For a directed graph the number of items are  (out-degree (v)) = | E | So we need  ( V + E ) –For undirected graph the number of items are  (degree (v)) = 2 | E | Also  ( V + E ) Easy to modify to handle weighted graphs. How? v  Vv  V v  Vv  V

Adjacency matrix representation |V | x |V | matrix A = ( a ij ) such that a ij = 1 if (i, j )  E and 0 otherwise. We arbitrarily uniquely assign the numbers 1, 2,..., | V | to each vertex.

Adjacency Matrix Representation for a Directed Graph

Adjacency Matrix Representation Advantage: –Saves space for: Dense graphs. Small unweighted graphs using 1 bit per edge. –Check for existence of an edge in  (1) Disadvantage: –Traverse all the edges that start at v, in  (|V|)

Adjacency Matrix Representation Storage –  ( | V | 2 ) ( We usually just write,  ( V 2 ) ) –For undirected graphs you can save storage (only 1/2(V 2 )) by noticing the adjacency matrix of an undirected graph is symmetric. How? Easy to handle weighted graphs. How?

Graph Algorithms

Shortest Path –Single Source –All pairs (Ex. Floyd Warshall) Network Flow Matching –Bipartite –Weighted Topological Ordering Strongly Connected

Graph Algorithms Biconnected Component / Articulation Point Bridge Graph Coloring Euler Tour Hamiltonian Tour CliqueIsomorphism Edge Cover Vertex Cover Visibility

Thank you