lecture_03 - Graphs Graphs: a simple way of representing...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Graphs Graphs: a simple way of representing pairwise relationships among a set of objects. Graph theory: an old subject with modern applications. Graph algorithms - algorithms for graph problems. 1 Reading • Dasguta et al. Chapter 3 • MIT book: Chapter 3.1 – 3.3: graphs Undirected and Directed Graphs Definition: An undirected graph G=(V,E) consists of s a set of vertices (nodes) V and s a set of edges E. Each edge is an unordered pair of vertices. E.g., {b,c} & {c,b} refer to the same edge. 3 Direcrted graphs: Each edge is an ordered pair of vertices. E.g., (b,c). a c b d e f a c b d e f Applications In computer science, graphs are often used to model s computer networks, s precedence among processes, s state space of playing chess (AI applications) source conflicts 4 s resource conflicts ... In other disciplines, graphs are also used to model the structure of objects. E.g., Biology - evolutionary relationship Chemistry - structure of molecules ... Representation of graphs. Consider a graph with n vertices and m edges. Assume the vertices are labeled from 1 to n. Adjacency matix : an n x n matrix M such that M[i,j] = 1 if {I,j} is an edge and M[i,j] = 0 otherwise. n 2 bits. 5 Adjacency lists : for each vertex i , there is a linked list of vertices adjacent to i ; plus an array Adj[ i ] points to the first node of the list of i . O((n + 2m) log n) bits. 1 2 3 4 2 4 Adj 1 3 1 Concepts & notations: Paths, Cycles • In an undirected graph, a path from a vertex u to a vertex v is a sequence of n ≥ 1 edges sharing common vertices. e 1 = { u , x 1 }, e 2 = {x 1 , x 2 }, … e n = {x n-1 , v }. • The length of this path is n. 6 • Note that a path from u to v implies a path from v to u . • Simple path: all vertices are distinct. • Cycle : u = v u v e 1 e 2 e n Connectivity In an undirected graph G, two vertices u and v are said to be connected if there is a path from u to v. G is said to be connected if every pair of vertices are connected. 7 Graphs that are not connected • Given an undirected graph G that is not connected, we can partition the vertices into maximal subsets such that vertices within each subset are connected. Each such subset is called a connected component of G....
View Full Document

This note was uploaded on 03/01/2010 for the course CS 1234 taught by Professor Chan during the Spring '10 term at University of the Bío-Bío.

Page1 / 29

lecture_03 - Graphs Graphs: a simple way of representing...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online