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.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent,
CS 253: Algorithms Chapter 22 Graphs Credit: Dr. George Bebis.
Analysis of Algorithms CS 477/677
Chapter 9 Graphs.
Every edge is in a red ellipse (the bags). The bags are connected in a tree. The bags an original vertex is part of are connected.
Graph-02.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Lecture 17 Path Algebra Matrix multiplication of adjacency matrices of directed graphs give important information about the graphs. Manipulating these.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
CSE 321 Discrete Structures Winter 2008 Lecture 25 Graph Theory.
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.
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.
Chapter 9: Graphs Basic Concepts
Degree A F H G B E D C. Adjacent A F H G B E D C.
Graph Operations And Representation. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
9.3 Representing Graphs and Graph Isomorphism
ALG0183 Algorithms & Data Structures Lecture 18 The basics of graphs. 8/25/20091 ALG0183 Algorithms & Data Structures by Dr Andy Brooks.
GRAPH Learning Outcomes Students should be able to:
Graph. Data Structures Linear data structures: –Array, linked list, stack, queue Non linear data structures: –Tree, binary tree, graph and digraph.
Graphs CS /02/05 Graphs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Definition.
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.
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.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
7.1 and 7.2: Spanning Trees. A network is a graph that is connected –The network must be a sub-graph of the original graph (its edges must come from the.
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.
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.
Graph.
Graph Theory. A branch of math in which graphs are used to solve a problem. It is unlike a Cartesian graph that we used throughout our younger years of.
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.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
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,
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Graph Theory. undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Great Theoretical Ideas in Computer Science for Some.
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.
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.
 Hamilton paths.  Definition 20: A Hamilton paths is a path that contains each vertex exactly once. A Hamilton circuit is a circuit that contains.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
COMPSCI 102 Introduction to Discrete Mathematics.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
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:
CS120 Graphs.
Chapter 9: Graphs Basic Concepts
Graph Operations And Representation
Connectivity Section 10.4.
Walks, Paths, and Circuits
Warm Up – Wednesday.
Representing Graphs Wade Trappe.
Hamiltonian Cycles.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Discrete Mathematics for Computer Science
Warm Up – Tuesday Find the critical times for each vertex.
Graphs: Definitions How would you represent the following?
Chapter 9: Graphs Basic Concepts
GRAPHS.
For Friday Read chapter 9, sections 2-3 No homework
Presentation transcript:

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 (i,j) is an edge a ij = 0 if (i,j) is not an edge Good for dense graphs!

3 Example A =

4 Counting Paths The number of paths of length k from node i to node j is the entry in position (i,j) in the matrix A k A 2 = =

5 Adjacency List Suppose we have a graph G with n nodes. The adjacency list is the list that contains all the nodes that each node is adjacent to Good for sparse graphs!

6 Example : 2,3 2: 1,3,4 3: 1,2,4 4: 2,3

7 Terms to know Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components Spanning Tree

8 Here’s What You Need to Know… Adjacency Matrix and List Definition Useful for counting