GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.

Slides:



Advertisements
Similar presentations
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
Advertisements

1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Discrete Mathematics and Its Applications
Introduction to Graph Theory Sections /1/2004Discrete Mathematics for Teachers, UT Math 504, Lecture 08 2 Introduction The three sections we.
Applied Discrete Mathematics Week 12: Trees
1 Section 8.2 Graph Terminology. 2 Terms related to undirected graphs Adjacent: 2 vertices u & v in an undirected graph G are adjacent (neighbors) in.
SE561 Math Foundations Week 11 Graphs I
Graph Theory in CS Route Search in Online Map Services
Math Foundations Week 12 Graphs (2). Agenda Paths Connectivity Euler paths Hamilton paths 2.
Copyright © Zeph Grunschlag, Paths and Connectivity Zeph Grunschlag.
1 Section 8.4 Connectivity. 2 Paths In an undirected graph, a path of length n from u to v, where n is a positive integer, is a sequence of edges e 1,
Selected Topics in Data Networking Graph Representation.
Applied Discrete Mathematics Week 12: Trees
Graphs.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
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,
1 Graphs Chapters 9.1 and 9.2 University of Maryland Chapters 9.1 and 9.2 Based on slides by Y. Peng University of Maryland.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
 期中测验时间:  11 月 4 日  课件 集合,关系,函数,基数, 组合数学.  Ⅰ Introduction to Set Theory  1. Sets and Subsets  Representation of set:  Listing elements, Set builder.
Lecture 5.2: Special Graphs and Matrix Representation CS 250, Discrete Structures, Fall 2013 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
Module #19: Graph Theory: part I Rosen 5 th ed., chs. 8-9 내년 3 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
Copyright © Zeph Grunschlag, More on Graphs.
Advanced Computer Networks: Part 1 Complex Networks, P2P Networks and Swarm Intelligence on Graphs.
1 CS104 : Discrete Structures Chapter V Graph Theory.
9.1 Introduction to Graphs
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
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.
9 Graphs. 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.
COSC 2007 Data Structures II Chapter 14 Graphs I.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
Basic properties Continuation
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graph Terminologies Department of CE/IT M.S.P.V.L.Polytechnic College,
Graphs Basic properties.
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Lecture 5.1: Graphs Basics
Chapter 9: Graphs.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Lecture 5.3: Graph Isomorphism and Connectivity CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Zeph Grunschlag.
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Fundamental Graph Theory (Lecture 1) Lectured by Hung-Lin Fu 傅 恆 霖 Department of Applied Mathematics National Chiao Tung University.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
Chapter 9 (Part 2): Graphs
Lecture 5.2: Special Graphs and Matrix Representation
Lecture 19: CONNECTIVITY Sections
Applied Discrete Mathematics Week 13: Graphs
Basic Concepts Graphs For more notes and topics visit:
Copyright © Zeph Grunschlag,
Graph Graphs and graph theory can be used to model:
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Grade 11 AP Mathematics Graph Theory
CS 250, Discrete Structures, Fall 2015
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Graphs.
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Let us switch to a new topic:
Applied Discrete Mathematics Week 13: Graphs
Concepts of Computation
Presentation transcript:

GRAPHS THEROY

2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism Adjacency matrices Types of Graphs Trees Undirected graphs  Simple graphs, Multigraphs, Pseudographs Digraphs, Directed multigraph Bipartite Complete graphs, cycles, wheels, cubes, complete bipartite

3 Graphs –Notion A graph is a bunch of vertices (or nodes) represented by circles which are connected by edges, represented by line segments. Mathematically, graphs are binary-relations on their vertex set (except for multigraphs). In Data Structures one often starts with trees and generalizes to graphs. In this course, opposite approach: We start with graphs and restrict to get trees.

4 Graphs: Basic Definitions A graph, G, comprises a set V of vertices and a set E of edges. The vertex set can be anything, but is most commonly a collection of letters or numbers. The set of edges is a set of doubleton subsets of V. That is E ⊆ {{a,b}:a,b ∈ V and a≠b}. We denote the graph by G(V,E). If G(V,E) is a graph and {a,b} ∈ E, then we say vertices a and b are adjacent and the edge {a,b} joins them or connects them or is incident on them. We call a and b the endpoints of the edge. Two edges that share one vertex, such as {a,b} and {b,c} with a≠c, are adjacent to each other.

5 Graphs: Examples Let V={a,b,c,d} and E={{a,b},{a,c},{b,c},{c,d}} a c d b

6 Graphs: Subgraphs The second graph below is a subset of the first. a c d b a c b

7 Walks and Paths V5V5 V4V4 V3V3 V2V2 V1V1 V6V6 4 1 A walk is an sequence of nodes (v 1, v 2,..., v L ) such that {(v 1, v 2 ), (v 1, v 2 ),..., (v 1, v 2 )} E, e.g. (V 2, V 3,V 6, V 5,V 3 ) A simple path is a walk with no repeated nodes, e.g. (V 1, V 4,V 5, V 2,V 3 )

8 Graphs: An Example of a Path Example: In the following diagram the red edges show a simple path of length three from a to e. The path is acde. Of course this could also be the non-simple path acdcacacdede of length 11. a b c d e

9 Connected Graphs A D E F BC A B C D 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 A directed graph is strongly connected if there is a directed path from any node to any other node

10 Graphs: Connectedness Intuitively a graph is connected if it has no parts that are isolated from each other, if you can get from each part to every other part. Formally we say a graph is connected if there exists a path between every pair of distinct vertices. Clearly this is equivalent to saying there is a simple path between every pair of distinct vertices. The graph just given is connected, but the following one is not since you cannot, for instance, get from a to d. a b c d e

11 Trees A very important type of graph in CS is called a tree: Real Tree

12 Trees A very important type of graph in CS is called a tree: Real Tree transformation

13 Trees A very important type of graph in CS is called a tree: Real Tree transformation

14 Trees A very important type of graph in CS is called a tree: Real Abstract Tree transformation

15 Simple Graphs Different purposes require different types of graphs. EG: Suppose a local computer network Is bidirectional (undirected) Has no loops (no “self-communication”) Has unique connections between computers Sensible to represent as follows:

16 Simple Graphs Vertices are labeled to associate with particular computers Each edge can be viewed as the set of its two endpoints {1,2} {3,4} {2,4}{1,3} {2,3} {1,4}

17 Simple Graphs DEF: A simple graph G = (V,E ) consists of a non-empty set V of vertices (or nodes) and a set E (possibly empty) of edges where each edge is a subset of V with cardinality 2 (an unordered pair). Q: For a set V with n elements, how many possible edges there?

18 Simple Graphs A: The number of pairs in V = n · (n -1) / 2 Q: How many possible graphs are there for the same set of vertices V ?

19 Simple Graphs A: The number of subsets in the set of possible edges. There are n · (n -1) / 2 possible edges, therefore the number of graphs on V is 2 n(n -1)/2

20 Multigraphs If computers are connected via internet instead of directly, there may be several routes to choose from for each connection. Depending on traffic, one route could be better than another. Makes sense to allow multiple edges, but still no self-loops:

21 Multigraphs Edge-labels distinguish between edges sharing same endpoints. Labeling can be thought of as function: e 1  {1,2}, e 2  {1,2}, e 3  {1,3}, e 4  {2,3}, e 5  {2,3}, e 6  {1,2} e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

22 Multigraphs DEF: A multigraph G = (V,E,f ) consists of a non-empty set V of vertices (or nodes), a set E (possibly empty) of edges and a function f with domain E and codomain the set of pairs in V.

23 Undirected Graphs Terminology Vertices are adjacent if they are the endpoints of the same edge. Q: Which vertices are adjacent to 1? How about adjacent to 2, 3, and 4? e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

24 Undirected Graphs Terminology A:1 is adjacent to 2 and 3 2 is adjacent to 1 and 3 3 is adjacent to 1 and 2 4 is not adjacent to any vertex e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

25 Undirected Graphs Terminology A vertex is incident with an edge (and the edge is incident with the vertex) if it is the endpoint of the edge. Q: Which edges are incident to 1? How about incident to 2, 3, and 4? e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

26 Undirected Graphs Terminology A:e 1, e 2, e 3, e 6 are incident with 1 2 is incident with e 1, e 2, e 4, e 5, e 6 3 is incident with e 3, e 4, e 5 4 is not incident with any edge e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

27 Digraphs Last time introduced digraphs as a way of representing relations: Q: What type of pair should each edge be (multiple edges not allowed)?

28 Digraphs A: Each edge is directed so an ordered pair (or tuple) rather than unordered pair. Thus the set of edges E is just the represented relation on V (1,2) (1,1) (2,2) (2,4) (1,3) (2,3) (3,4) (3,3) (4,4)

29 Digraphs DEF: A directed graph (or digraph) G = (V,E ) consists of a non-empty set V of vertices (or nodes) and a set E of edges with E  V  V. The edge (a,b) is also denoted by a  b and a is called the source of the edge while b is called the target of the edge. Q: For a set V with n elements, how many possible digraphs are there?

30 Digraphs A: The same as the number of relations on V, which is the number of subsets of V  V so 2 n·n.

31 Directed Multigraphs If also want to allow multiple edges in a digraph, get a directed multigraph (or multi-digraph). Q: How to use sets and functions to deal with multiple directed edges, loops? 1 2 3

32 Directed Multigraphs A: Have function with domain the edge set and codomain V  V. e 1  (1,2), e 2  (1,2), e 3  (2,2), e 4  (2,3), e 5  (2,3), e 6  (3,3), e 7  (3,3) e1e1 e3e3 e2e2 e4e4 e5e5 e7e7 e6e6

33 Degree The degree of a vertex counts the number of edges that seem to be sticking out if you looked under a magnifying glass: 12 3 e1e1 e3e3 e2e2 e4e4 e5e5 e6e6

34 Degree The degree of a vertex counts the number of edges that seem to be sticking out if you looked under a magnifying glass: 12 3 e1e1 e3e3 e2e2 e4e4 e5e5 e6e6 magnify

35 Degree The degree of a vertex counts the number of edges that seem to be sticking out if you looked under a magnifying glass: Thus deg(2) = 7 even though 2 only incident with 5 edges. Q: How to define this formally? 12 3 e1e1 e3e3 e2e2 e4e4 e5e5 e6e6 magnify

36 Degree A: Add 1 for every regular edge incident with vertex and 2 for every loop. Thus deg(2) = = e1e1 e3e3 e2e2 e4e4 e5e5 e6e6 magnify

37 Oriented Degree when Edges Directed The in-degree of a vertex (deg - ) counts the number of edges that stick in to the vertex. The out-degree (deg + ) counts the number sticking out. Q: What are in-degrees and out-degrees of all the vertices? 1 2 3

38 Oriented Degree when Edges Directed A: deg - (1) = 0 deg - (2) = 3 deg - (3) = 4 deg + (1) = 2 deg + (2) = 3 deg + (3) =

39 Graph Patterns Complete Graphs - K n A simple graph is complete if every pair of distinct vertices share an edge. The notation K n denotes the complete graph on n vertices. K 1 K 2 K 3 K 4 K 5

40 Graph Patterns Cycles - C n The cycle graph C n is a circular graph with V = {0,1,2,…,n-1} where vertex i is connected to i +1 mod n and to i -1 mod n. They look like polygons: C 1 C 2 C 3 C 4 C 5 Q: What type of graph are C 1 and C 2 ?

41 Graph Patterns Wheels - W n A: Pseudographs The wheel graph W n is just a cycle graph with an extra vertex in the middle: W 1 W 2 W 3 W 4 W 5 Usually consider wheels with 3 or more spokes only.

42 Graph Patterns Cubes - Q n The n-cube Q n is defined recursively. Q 0 is just a vertex. Q n+1 is gotten by taking 2 copies of Q n and joining each vertex v of Q n with its copy v’ : Q 0 Q 1 Q 2 Q 3 Q 4 (hypercube)

43 Subgraphs Notice that the 2-cube occurs inside the 3-cube. In other words, Q 2 is a subgraph of Q 3 : DEF: Let G = (V,E ) and H = (W,F ) be graphs. H is said to be a subgraph of G, if W  V and F  E. Q: How many Q 2 subgraphs does Q 3 have?

44 Subgraphs A: Each face of Q 3 is a Q 2 subgraph so the answer is 6, as this is the number of faces on a 3-cube:

45 Unions In previous example can actually reconstruct the 3-cube from its 6 2- cube faces:

46 Unions If we assign the 2-cube faces (aka Squares) the names S 1, S 2, S 3, S 4, S 5, S 6 then Q 3 is the union of its faces: Q 3 = S 1  S 2  S 3  S 4  S 5  S 6

47 Unions DEF: Let G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) be two simple graphs (and V 1,V 2 may or may not be disjoint). The union of G 1, G 2 is formed by taking the union of the vertices and edges. I.E: G 1  G 2 = (V 1  V 2, E 1  E 2 ). A similar definitions can be created for unions of digraphs, multigraphs, pseudographs, etc.

48 Thank you Share your ideas at any area; R.PURUSOTHAMAN,PGDCA,MCP,MCSE 1MSC(CS) Mob: ,