{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

11graph_10_v3

# 11graph_10_v3 - ENGG1007 FCS ENGG1007 Foundations of...

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

1 ENGG1007 FCS ENGG1007 Foundations of Computer Science Click to edit Master subtitle style Graphs Prof. Francis Chin, Dr SM Yiu November 4/5, 2010 (Chapter 9)

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

View Full Document
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

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

View Full Document
4 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 ): | | ) ( deg ) ( deg E v v V v V v = = + - | | 2 ) deg( E v V v = z x y u
5 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

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

View Full Document
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 g { 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 ) ? When number(x)=number(0), whose move = 0 else = x X X s 1 s 2 s 4 s 5 s 9 s 6 s 3 s 8 s 7
7 ENGG1007 FCS Game tree - Tic tac toe Example: initial state, v0 = ( ( -, -, -, -, -, -, -, -, - ), 0 ) v5 = ( ( x, -, 0, 0, 0, -, x, -, - ), x ) Edges = move (reachability denoted by directed edges) Example: states (positions) reached by v5 (v5, v6 ), where v6 = ( ( x, x, 0, 0, 0, -, x, -, - ), 0 ) (v5, v6‘), where

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.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern