1 section 8.1 introduction to graphs. 2 graph a discrete structure consisting of a set of vertices...

12
1 Section 8.1 Introduction to Graphs

Upload: jesse-simpson

Post on 18-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

1

Section 8.1

Introduction to Graphs

Page 2: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

2

Graph

• A discrete structure consisting of a set of vertices and a set of edges connecting these vertices– used to model relationships between entities in

a variety of fields– used to solve various types of problems

Page 3: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

3

Graph types: simple graph

• Consists of V, a non-empty set of vertices and E, a set of unordered pairs of distinct elements of V

• Example: V={A,B,C,D,E} E={(A,B),(B,C),(B,E),(E,C),(D,E)}

• Note that, since pairs are unordered, each could be listed either way

A B

C

D E

Page 4: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

4

Graph types: multigraph

• Consists of a set of vertices (V), a set of edges (E), and a function f from E to {{u,v} | u, v V, u v}

• Edges e1 and e2 are called multiple or parallel edges if f(e1) = f(e2)

• In a simple graph, multiple edges are not allowed, but in a multigraph they are

A B

C

D E

Page 5: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

5

Graph types: pseudograph

• Like a multigraph in which loops are allowed; to formally define, must be able to associate edges to sets containing just one vertex

• Pseudograph consists of a set V of vertices, a set E of edges, and a function f from E to {{u,v} | u,v V}

• An edge is a loop if f(e) = {u,u} = {u} for some u V

Page 6: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

6

Pseudograph

• Note that multiple edges in a pseudograph may be associated with the same pair of vertices: we say that {u,v} is an edge of graph G = {V,E} if there is at least one edge e with f(e) = {u,v}

• Example:

Page 7: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

7

Undirected graphs

• Pseudographs are the most general type - can contain loops and multiple edges

• Multigraphs are undirected graphs that may contain multiple edges but not loops

• Simple graphs are undirected graphs with no multiple edges or loops

Page 8: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

8

Directed Graphs

• A directed graph (digraph) consists of a set of vertices (V) and a set of edges (E) that are ordered pairs of elements of V

• Example: V={A,B,C,D} E={(B,A),(B,C),(C,A),(C,D),(D,C)}

Page 9: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

9

Directed Multigraph

• Directed multigraph G=(V,E) consists of a set V or vertices, a set E of edges, and a function f from E to {(u,v)|u,vV}

• Edges e1 and e2 are multiple edges if f(e1)=f(e2)

• Multiple directed edges are associated to the the same pair of vertices

• (u,v) is an edge of G=(V,E) as long as there is at least one edge e with f(e) = (u,v)

Page 10: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

10

Modeling with graphs - examples

• Niche overlap graph in ecology:– each species represented by vertex– undirected edge connects 2 vertices if the

species compete

• Influence graph:– each person in group is represented by vertex– directed edge from vertex a to vertex b when a

has influence on b

Page 11: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

11

Modeling with graphs - examples

• Round-robin tournament graph:– each team represented by vertex– (a,b) is an edge if team a beats team b

• Precedence graph:– vertices represent statements in a computer

program– directed edge between vertices means 1st

statement must be executed before 2nd

Page 12: 1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used

12

Section 7.1

Introduction to Graphs