Lec16_17_18_Graph

# Lec16_17_18_Graph - Graph Theory and Representation Graph...

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

Graph Theory and Representation

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

View Full Document
Graph Algorithms Graphs and Theorems about Graphs Graph implementation Graph Algorithms Shortest paths minimum spanning tree
What can graphs model? Cost of wiring electronic components together. Shortest route between two cities. Finding the shortest distance between all pairs of cities in a road atlas. Flow of material (liquid flowing through pipes, current through electrical networks, information through communication networks, parts through an assembly line, etc). State of a machine. Used in Operating systems to model resource handling (deadlock problems). Used in compilers for parsing and optimizing the code.

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

View Full Document
What is a Graph? Informally a graph is a set of nodes joined by a set of lines or arrows. 1 1 2 3 4 4 5 5 6 6 2 3
A directed graph , also called a digraph G is a pair ( V , E ), where the set V is a finite set and E is a binary relation on V . The set V is called the vertex set of G and the elements are called vertices. The set E is called the edge set of G and the elements are edges (also called arcs ). A edge from node a to node b is denoted by the ordered pair ( a , b ). 1 2 3 4 5 6 V = { 1, 2, 3, 4, 5, 6, 7 } | V | = 7 E = { (1,2), (2,2), (2,4), (4,5), (4,1), (5,4),(6,3) } | E | = 7 Self loop 7 Isolated node

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

View Full Document
An undirected graph G = ( V , E ) , but unlike a digraph the edge set E consist of unordered pairs. Our text uses the notation ( a, b ) to refer to a directed edge, and { a , b } for an undirected edge. A D E F B C V = { A, B, C, D, E, F } | V | = 6 E = { {A, B}, {A,E}, {B,E}, {C,F} } | E | = 4 Some texts use (a, b) also for undirected edges. So ( a , b ) and ( b , a ) refers to the same edge.
Degree of a Vertex in an undirected graph is the number of edges incident on it. In a directed graph , the out degree of a vertex is the number of edges leaving it and the in degree is the number of edges entering it. A D E F B C The degree of B is 2. 1 2 4 5 The in degree of 2 is 2 and the out degree of 2 is 3. Self-loop

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

View Full Document
Cyclic and Acyclic A path from a vertex to itself is called a cycle (e.g., v1 v2 v4 v1) If a graph contains a cycle, it is cyclic Otherwise, it is acyclic A path is simple if it never passes through the same vertex twice. 1 2 4 5
Simple Graphs Simple graphs are graphs without multiple edges or self-loops. We will consider only simple graphs. Proposition: If G is an undirected graph then Σ deg( v ) = 2 | E | Proposition: If G is a digraph then Σ indeg( v ) = Σ outdeg( v ) = |E | v G v G v G

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

View Full Document
A weighted graph is a graph for which each edge has an associated weight , usually given by a weight function w: E R . 1 2 3 4 5 6 .5 1.2 .2 .5 1.5 .3 1 4 5 6 2 3 2 1 3 5
A path is a sequence of vertices such that there is an edge from each vertex to its successor. A path from a vertex to itself is called a cycle . A graph is called cyclic if it contains a cycle; otherwise it is called acyclic A path is simple if each vertex is distinct.

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.

## This document was uploaded on 01/04/2010.

### Page1 / 53

Lec16_17_18_Graph - Graph Theory and Representation Graph...

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

View Full Document
Ask a homework question - tutors are online