1 topics intro. to graphs (11.1) a b c d ef g. 2 definition (p.650) a graph g = v(g) + e(g) a set of...

20
1 Topics Intro. to Graphs (11.1) A B C D E F G

Upload: randolf-simon

Post on 01-Jan-2016

220 views

Category:

Documents


5 download

TRANSCRIPT

Page 2: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

2

Definition (p.650)

• A graph G = V(G) + E(G)• A set of vertices (or nodes), V(G) = {v1, v2, …, vn}• A set of edges (or arcs)

E(G) = {<vi, vj> | vi V(G) and vj V(G) }

• Exercise: Draw the graph G, where V(G) = {a, b, c, d, e, f}, and

E(G) = {e1:<a,c>, e2:<a,b>, e3:<c,d>, e4:<c,c>, e5:<d,a>,

e6:<d,c>, e7:<e,f>}

– List all the vertices adjacent to vertex c.– List all the edges adjacent to edge e3.– What are the edges incident on vertex d?– Is there any loop in G?– Is there any isolated vertex?– Are there any parallel edges?

Page 3: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

3

Interpretation of Graphs

• What could the following graph represent?

 A graph with 6 vertices and 7 edges.

Source: http://en.wikipedia.org/wiki/Graph_%28mathematics%29

Page 4: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

4

Directed Graphs (p.653)

• A directed graph (or digraph) G = V(G) + E(G)• A set of vertices, V(G) = {v1, v2, …, vn}• A set of directed edges (or arrows),

E(G) = {<vi, vj> | vi V(G) and vj V(G) }

Each <vi, vj> is an ordered pair.

vi: the head vj: the tail

vi is the direct predecessor of vj

vj is the direct successor of vi

• Exercise: Draw the digraph G, where V(G) = {a, b, c, d, e, f} and E(G) = {e1:<a,c>, e2:<a,b>, e3:<c,d>, e4:<c,c>, e5:<d,a>, e6:<d,c>, e7:<e,f>}

Page 5: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

5

Sociograms• A sociogram is a graphic representation of relationships among

individuals. See http://en.wikipedia.org/wiki/Sociogram.

A vertex in a sociogram represents an individual.

A directed edge represents ‘friendship’ or ‘flow of information’.• Exercise: Show V(G) and E(G) in the following digraph.

A

B

C

D

E F

G

• Is there any star in the sociogram?

• Any isolates?• Does there exist any clique?• Is there a way for G to pass

information to F?• Could G pass information to A?• Could A pass information to G?

Page 6: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

6

More Examples of Graphs

• pp.654-655: – Knowledge representation– Problem solving

Page 7: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

7

Is a diagram a graph?

• Not necessarily• But sometimes (e.g., Hasse diagrams, pp.636-639)

• A diagram is a 2D symbolic representation of information according to some visualization technique.

• Three main types of diagrams:– Graph-based diagrams (tree diagram, network diagram,

flowchart, …)– Chart-like diagrams (histogram, pie chart, function graph, …)– Other types of diagrams (exploded view)

See http://en.wikipedia.org/wiki/Diagram for a comprehensive list of specific diagram types.

Page 8: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

8

Network DiagramsA sample network diagram: http://en.wikipedia.org/wiki/Network_diagram

Page 9: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

9

A network diagram for the Distributed Computer Security Lab: See http://www.dcsl-uhcl.net/public/DCSL%20diagram.html

Page 10: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

10

A Sensor Network Topology• Source: http://www.purelink.ca/images/sensor_network_big.gif

Page 11: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

11

• A sample UML (Unified Modeling Language) diagram http://sce.uhcl.edu/yang/teaching/csci5333Fall04/uml%20company%20DB.gif

Page 12: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

12

Questions?

Page 13: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

13

Simple Graphs• p.656: A simple graph is an undirected graph with no loops or

parallel edges.

• A complete graph on n vertices, Kn, is a simple graph with n

vertices v1, v2, …, vn whose set of edges contains exactly one edge

for each pair of distinct vertices.

• Q: Which of the following are simple graphs? Which are complete graphs?A

BC

(e)

A

B C(b)

A

(a)

A

B

(c)

A

B

(d)

AB

C

(f)

A

B

C(g)

A

B

C

X

Y(h)

A

B

C

X

Y(i)

Page 14: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

14

Complete Graphs

• Q: How many edges are there in a complete graph on n vertices, Kn?

• Number of edges in Kn

= 1+2+…+(n-1)

=

n edges

1 0

2 1

3 1+2

4 1+2+3

n 1+2+…+(n-1)

Page 15: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

15

Bipartite Graphs• A bipartite graph (or bigraph) is a graph whose vertices can be

divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V. (Source: http://en.wikipedia.org/wiki/Bipartite_graph)

A

B

C

X

Y

Page 16: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

16

Complete Bipartite Graphs

• A complete bipartite graph, Km,n

• Definition: p.657

K3,2

A

B

C

X

Y

• Q: How many edges are there in a complete bipartite graph Km,n?

• Number of edges in Km,n

=

Page 17: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

17

Subgraphs• p.657: A graph H is a subgraph of a graph G iff

a. Every vertex in H is also in G.b. Every edge in H is also in G.c. Every edge in H has the same endpoints as in G.

• Example 11.1.10

• Remember the cliques in the example sociogram? A clique is a complete subgraph.

A

B

C

D

E F

G

• Subgraphs of a graph which are cliques may be referred to as cliques in that graph.

• The largest clique in a graph G is of theoretical importance and denoted ω(G).

Page 18: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

18

The Concept of Degree

• The degree of a vertex v

deg(v) = the number of edges that are incident on vNote: A loop on v is counted twice.

• The total degree of a graph G with n vertices

=

= 2(the number of edges in G) the Handshake Theorem (p.659)

• Example 11.1.11: p.658

n

iiv

1

)deg(

Page 19: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

19

The Handshake Theorem

• Therefore, the total degree of a graph is even.• Also, the number of vertices with odd degree is even

(p.661)

• Useful when determining whether a graph with certain properties exists or not.

• Example 11.1.12• Example 11.1.14

Page 20: 1 Topics Intro. to Graphs (11.1) A B C D EF G. 2 Definition (p.650) A graph G = V(G) + E(G) A set of vertices (or nodes), V(G) = {v 1, v 2, …, v n } A

20

Questions?