11graph_10

# 11graph_10 - 1 ENGG1007 FCS 1 ENGG1007 Foundations of...

This preview shows pages 1–7. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 ENGG1007 FCS 1 ENGG1007 Foundations of Computer Science Click to edit Master subtitle style Graphs Prof. Francis Chin, Dr SM Yiu November 4/5, 2010 (Chapter 9) 2 ENGG1007 FCS What is a Graph? A simple graph G = ( V , E ) consists of Ø V , the set of vertices (nodes, points) , and Ø E , the set of edges (lines) Undirected graphs are graphs where edges have no direction ( unordered pairs of V ). Example: V = {a, b, c, d, e} E = {{a,b}, {a, c}, {c, d}, {c, e}, {d, e}} Directed graphs are graphs where edges have directions, i.e., E consists of ordered pairs of V Example: V = {u, x, y, z} E = {(x, y), (x, z), (y, u), (z, x), (z, u)} a b c d e z x y u 3 ENGG1007 FCS Simple Graphs and Multigraphs Simple graphs- at most one edge between any pair of vertices. Multi-graphs- having multiple edges between the same pair of vertices, or even with self-loops. Examples: Ø Multiple roads between same pair of cities If x , y are two vertices, and e = { x , y } is in E , then Ø x and y are adjacent Ø e is incident with x and y Ø x and y are the endpoints of e Degree ( v ) = number of edges incident with vertex v Ø deg ( y ) = 2 , deg ( u ) = 2 , deg ( x ) = 3 , deg ( z ) = 5 z x y u 4 ENGG1007 FCS Other Applications – Graph Models Acquaintanceship vertices = people edges = two people know each other Competition (tournaments) vertices = teams edges = matches (directed edges to show winners and losers) Game tree vertices = state of the game Edge = move 5 ENGG1007 FCS Graph properties: Degrees By pigeon hole principle, there exist two vertices with the same degree. For an undirected graph G = ( V , E ): e.g. sum of degrees = 3+2+5+2 = 12, | E | = 6 Proof: every edge is counted twice in counting degrees. Fact: Any undirected graph has an even number of odd- degree vertices (as the sum of degrees is even) For a directed graph G = ( V , E ): z x y u 6 ENGG1007 FCS Game tree - Tic tac toe Vertices = state of the game represented by (position, whose move) position = (s1, s2, s3, s4, s5, s6, s7, s8, s9 ), where s i W { x, 0, - } Example: initial state, v0 = ( ( -, -, -, -, -, -, -, -, - ), 0 ) v5 = ( ( x, -, 0, 0, 0, -, x, -, - ), x ) What are valid vertices? Assuming 0 is the first move, say vi = ( ( x, -, x, 0, 0, -, x, -, - ), x ) ? If ‘0’ is the first moves, number(x)=number(0)-1 or number(0) say vj = ( ( x, -, x, 0, 0, -, x, 0, - ), x ) ?...
View Full Document

{[ snackBarMessage ]}

### Page1 / 28

11graph_10 - 1 ENGG1007 FCS 1 ENGG1007 Foundations of...

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

View Full Document
Ask a homework question - tutors are online