GRAPH THEORY.  A graph is a collection of vertices and edges.  An edge is a connection between two vertices (or nodes).  One can draw a graph by marking.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
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,
Graph-02.
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
Chapter 8, Part I Graph Algorithms.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
1 Representing Graphs. 2 Adjacency Matrix Suppose we have a graph G with n nodes. The adjacency matrix is the n x n matrix A=[a ij ] with: a ij = 1 if.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Introduction to Graphs
1 Data Structures and Algorithms Graphs I: Representation and Search Gal A. Kaminka Computer Science Department.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
Chapter 9: Graphs Basic Concepts
9.3 Representing Graphs and Graph Isomorphism
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
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.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Lecture 13 Graphs. Introduction to Graphs Examples of Graphs – Airline Route Map What is the fastest way to get from Pittsburgh to St Louis? What is the.
Computer Science 112 Fundamentals of Programming II Introduction to Graphs.
Chapter 2 Graph Algorithms.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
COSC 2007 Data Structures II Chapter 14 Graphs I.
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.
Data Structures CSCI 132, Spring 2014 Lecture 38 Graphs
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Graphs Graphs are collections of vertices and edges. Vertices are simple objects with associated names and other properties. Edges are connections between.
Homework #5 Due: October 31, 2000 Christine Kang Graph Concepts and Algorithms.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Introduction to Graph Theory
Graphs and Paths : Chapter 15 Saurav Karmakar
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.
Graph Revisited Fei Chen CSCI2100B Data Structures Tutorial 12 1.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Graph Terms By Susan Ott. Vertices Here are 7 vertices without any edges Each Vertex is labeled a different color and number.
CSC 213 – Large Scale Programming Lecture 31: Graph Traversals.
1 Data Structures and Algorithms Graphs. 2 Graphs Basic Definitions Paths and Cycles Connectivity Other Properties Representation Examples of Graph Algorithms:
CSC 252 Pallavi Moorthy Homework 5. 1.) Vertices, edges From cd../../handout/demo/graph_alg/gw_shortest_path.
BCA-II Data Structure Using C Submitted By: Veenu Saini
Matrix Representation of Graphs
Introduction to Graphs
ACSL Round 3 March 2014.
Basic Concepts Graphs For more notes and topics visit:
Graph theory Definitions Trees, cycles, directed graphs.
Introduction to Graphs
EMIS 8373: Integer Programming
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.
Chapter 9: Graphs Basic Concepts
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Graph Operations And Representation
Chapter 11 Graphs.
Representing Graphs Wade Trappe.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
10.4 Connectivity Dr. Halimah Alshehri.
Graphs G = (V, E) V are the vertices; E are the edges.
Important Problem Types and Fundamental Data Structures
Chapter 9: Graphs Basic Concepts
GRAPHS.
For Friday Read chapter 9, sections 2-3 No homework
Introduction to Graphs
Presentation transcript:

GRAPH THEORY

 A graph is a collection of vertices and edges.  An edge is a connection between two vertices (or nodes).  One can draw a graph by marking points for the vertices and drawing lines connecting them for the edges, but it must be borne in mind that the graph is defined independently of the representation.

DO THE FOLLOWING TWO DRAWINGS REPRESENT THE SAME GRAPH?

 A path from vertex x to y in a graph is a list of vertices, in which successive vertices are connected by edges in the graph. For example, BAFEG is path from B to G in the graph above. A simple path is a path with no vertex repeated. For example, BAFEGAC is not a simple path.

 A graph is connected if there is a path from every vertex to every other vertex in the graph. Intuitively, if the vertices were physical objects and the edges were strings connecting them, a connected graph would stay in one piece if picked up by any vertex. A graph which is not connected is made up of connected components. For example, the graph above has three connected components: {I, H}, {J, K, L, M} and {A, B, C, D, E, F, G}.

 A cycle is a path, which is simple except that the first and last vertex are the same (a path from a point back to itself). For example, the path AFEGA is a cycle in our example. Vertices must be listed in the order that they are traveled to make the path; any of the vertices may be listed first.  For clarity, we list the start / end vertex twice

 A graph with no cycles is called a tree. There is only one path between any two nodes in a tree. A tree on N vertices contains exactly N-1 edges. A spanning tree of a graph is a subgraph that contains all the vertices and forms a tree. A group of disconnected trees is called a forest.

 Directed graphs are graphs which have a direction associated with each edge. An edge xy in a directed graph can be used in a path that goes from x to y but not necessarily from y to x.

 A dag (directed acyclic graph) is a directed graph with no cycles.  We’ll denote the number of vertices in a given graph by V, the number of edges by E. Note that E can range anywhere from V to V 2 (or 1/2 V(V-1) in an undirected graph).  Graphs will all edges present are called complete graphs; graphs with relatively few edges present (say less than V log(V)) are called sparse; graphs with relatively few edges missing are called dense.

 It is frequently convenient to represent a graph by a matrix, as shown in the second sample problem below. If we consider vertex A as 1, B as 2, etc., then a “one” in M at row i and column j indicates that there is a path from vertex i to j. If we raise M to the pth power, the resulting matrix indicates which paths of length p exist in the graph. In fact, the quantity M p (i,j) is the number of paths.

Find the number of different cycles contained in the directed graph with vertices {A,B,C,D,E} and edges {AB,BA,BC,CD,DC,DB,DE}. SAMPLE PROBLEMS The cycles are: {A,B}, {B,C,D} and {C,D}. Thus, there are 3 cycles in the graph.

 In the following directed graph, find the total number of different paths from vertex A to vertex C of length 2 or 4. By inspection, the only path of length 2 is A  A  C. The paths of length 4 are: A  A  A  A  C, A  A  C  A  C and A  C  A  A  C. Alternatively, let matrix M represent the graph. Recall that the number of paths from vertex i to vertex j of length p equals M p (i,j). The values of M, M 2 and M 4 are: , 111, There is 1 path of length 2 (M 2 (1,3)) and 3 paths of length 4 (M 4 (1,3)).