 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree.

Slides:



Advertisements
Similar presentations
Review Binary Search Trees Operations on Binary Search Tree
Advertisements

Graph Theory.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Chapter 8, Part I Graph Algorithms.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 12 Graphs.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
Graphs CS3240, L. grewe.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
CS 206 Introduction to Computer Science II 11 / 11 / Veterans Day Instructor: Michael Eckmann.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
ITEC200 – Week 12 Graphs. 2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study.
Graphs CS-240/341. Graphs Used for representing many-to-many relationships –can take two forms directed (digraph) - a finite set of elements called vertices.
Introduction to Graphs
Introduction to Graphs What is a Graph? Some Example applications of Graphs. Graph Terminologies. Representation of Graphs. –Adjacency Matrix. –Adjacency.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
1 Graph Introduction Definitions. 2 Definitions I zDirected Graph (or Di-Graph) is an ordered pair G=(V,E) such that yV is a finite, non-empty set (of.
CS 206 Introduction to Computer Science II 11 / 03 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 03 / 25 / 2009 Instructor: Michael Eckmann.
CS Data Structures Chapter 6 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.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Graphs.
GRAPHS Education is what remains after one has forgotten what one has learned in school. Albert Einstein Albert Einstein Smitha N Pai.
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,
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
Graphs. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes to each other The set of.
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.
COSC 2007 Data Structures II Chapter 14 Graphs I.
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.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
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.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graphs Upon completion you will be able to:
Chapter 9: Graphs.
Graphs and Paths : Chapter 15 Saurav Karmakar
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Chapter 05 Introduction to Graph And Search Algorithms.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University Graphs Original Slides by Rada Mihalcea.
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.
Code: BCA302 Data Structures with C Prof. (Dr.) Monalisa Banerjee By.
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.
BCA-II Data Structure Using C Submitted By: Veenu Saini
Data Structures & Algorithm Analysis lec(8):Graph T. Souad alonazi
Data Structures 13th Week
Matrix Representation of Graphs
Basic Concepts Graphs For more notes and topics visit:
CS120 Graphs.
Refresh and Get Ready for More
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 Chapter 11 Objectives Upon completion you will be able to:
Graphs.
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Graphs.
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Graphs Chapter 7 Visit for more Learning Resources.
Graph Implementation.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Graphs G = (V,E) V is the vertex set.
GRAPHS.
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 .
Presentation transcript:

 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree of a Vertex Terminology: Degree of a Vertex  Graph terminology Graph terminology  Graph Traversal Graph Traversal  Graph representation Graph representation

 A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes to each other  The set of edges describes relationships among the vertices

 A graph G is defined as follows: G=(V,E) V(G): a finite, nonempty set of vertices E(G): a set of edges (pairs of vertices) back

 When the edges in a graph have no direction, the graph is called undirected

 When the edges in a graph have a direction, the graph is called directed (or digraph) E(Graph2) = {(1,3) (3,1) (5,9) (9,11) (5,7) Warning: if the graph is directed, the order of the vertices in each edge is important !! back

 Trees are special cases of graphs !! back

The degree of a vertex is the number of edges incident to that vertex For directed graph, the in-degree of a vertex v is the number of edges that have v as the head the out-degree of a vertex v is the number of edges that have v as the tail if di is the degree of a vertex i in a graph G with n vertices and e edges, the number of edges is

G1G1 G2G directed graph in-degree out-degree G3G3 in:1, out: 1 in: 1, out: 2 in: 1, out: Examples back

 Adjacent nodes: two nodes are adjacent if they are connected by an edge  Path: a sequence of vertices that connect two nodes in a graph  Complete graph: a graph in which every vertex is directly connected to every other vertex

 What is the number of edges in a complete undirected graph with N vertices? N * (N-1) / 2

 Weighted graph: a graph in which each edge carries a value back

 Problem: Search for a certain node or traverse all nodes in the graph  Depth First Search ◦ Once a possible path is found, continue the search until the end of the path  Breadth First Search ◦ Start several paths at a time, and advance in each one step at a time back

Graph Representations Adjacency Matrix Adjacency Lists

Adjacency Matrix Let G=(V,E) be a graph with n vertices. The adjacency matrix of G is a two-dimensional n by n array, say adj_mat If the edge (vi, vj) is in E(G), adj_mat[i][j]=1 If there is no such edge in E(G), adj_mat[i][j]=0 The adjacency matrix for an undirected graph is symmetric; the adjacency matrix for a digraph need not be symmetric

G1G1 G2G2 G4G symmetric undirected: n 2 /2 directed: n 2 back

Adjacency Lists (data structures) Each row in adjacency matrix is represented as an adjacency list.

G1G G3G G4G An undirected graph with n vertices and e edges ==> n head nodes and 2e list nodes back

Thank You