82
Graphs • context: functions • context: graphs and networks

Graphs context: functions context: graphs and networks

Embed Size (px)

Citation preview

Graphs

• context: functions

• context: graphs and networks

Varieties of graphs

• directed graphs

• multiple edges

• self-loops

The graph of a relation is a directed graph

with multiple edges and self-loops allowed

Simple graphs

• non-directed graphs

• ban multiple edges

• ban self-loops

• finite number of vertices

(implies finite number of edges)

Abstract example

A graph G has

a set of vertices V(G) = {A, B, C}

and a set of edges E(G) = {{A, B}, {A, C }}

now draw a picture!

NB language: one vertex, many vertices

like one matrix, many matrices

Abstract definition

A graph G

is a set of vertices

and a set of edges

rvvvGV ,..,)( 21

jivvGE ji |,)(

Varieties of graphsdisconnected connected

A graph is connected if, for any two vertices, there is a path in the graph from one to the other.

A graph is disconnected if there are vertices v1 and v2 without a path from v1 to v2.

When are two graphs equal?

Let G1 be a graph with vertices {A, B, C}

and edges {{A,B}, {A,C}}.

Let G2 be a graph with vertices {P, Q, R}

and edges {{P,Q}, {P,R}}.

Are these equal?

When are two graphs equal?

Two graphs are equal iff they have

equal vertex setsand equal edge sets

so G1 and G2 are not equal:

{A, B, C} is not equal to {P, Q, R}

When are two graphs “the same”?

Are these graphs “the same”?

what about these two:

Isomorphism

Isomorphism is a well-defined concept which sums up the vague intuitive idea of “the same”

All unequal, but isomorphic to each other

Isomorphism

One graph is isomorphic to another if there is a continuous change from one to the other

show this as a filmstrip/cartoon DGP?

Alphabet examples2. 3. 4.1.

6. 7. 8.5.

9. 10. 11. 12.

Definition of isomorphism

G1 is isomorphic to G2 if there is a

bijective function (bijection)

which is “edge-preserving”: ie.

(pronounce this?)

)(: 21 GVGVf

)(,)(, 21 GEvfvfGEvv jiji

A proof of isomorphism

Task: Show that these are isomorphic:

problem: to define a vertex function

we need to be able to refer to the vertices of the graphs

)(: 21 GVGVf

A proof of isomorphism

Task: Show that these are isomorphic:

TSRQPEDCBAf

GVGVf

,,,,,,,,:

)(: 21

A

BC

D

EP

Q

R

ST

f (A) = f (B) = f (C) =

f (D) = f (E) =

A proof of isomorphism

Task: Show that these are isomorphic:

There is more than one possibility for the edge-preserving vertex function f (how many?)

A

BC

D

EP

Q

R

ST

A proof of isomorphism

show the “edge-preserving property” using adjacency tables (or matrices)

G1

A

B

C

D

E

A

0

1

0

0

0

B

1

0

1

1

0

C

0

1

0

0

1

D

0

1

0

0

1

E

0

0

1

1

0

G2

R

S

P

T

Q

R

S

P

T

Q

f

The adjacency matrix game

1. Draw a graph

(limit it to four vertices to start with)

2. Work out its adjacency matrix

3. Challenge someone else to draw your graph by showing them the adjacency matrix

Your graphs are isomorphic.

Isomorphism

Show informally by gradually changing a picture (“morphing”?)

Show formally by setting up a bijection on the vertices and drawing up adjacency matrices which show edge-preservation (equal entries in the matrices).

Non-isomorphism

Examples from alphabet

there can’t be a bijection between the vertex sets because the vertex sets are different sizes.

3.1.

bijective is |)()(: 21 fGVGVf

Vertex set size under IM

If G1 and G2 are isomorphic

then V(G1) and V(G2) have equal size

If V(G1) and V(G2) are different sizes

then G1 and G2 are not isomorphic

2121 GVGVGG

2121 GGGVGV

Vertex set size conjecture

If V(G1) and V(G2) have equal size

then G1 and G2 are isomorphic

BEWARE - this is false!!counterexample?

Vertex set size conjecture

If V(G1) and V(G2) have equal size

then G1 and G2 are isomorphic

BEWARE - this is false!!

2.1. same sized vertex sets but not isomorphic

Grouping by vertex set size

Group the graphs by vertex-set size. Isomorphism is possible within groups but not between groups.

Grouping by vertex set size2. 3.

4.

1.

6.

7.8.

5.

9.10.

11. 12.

Group the graphs by vertex-set size. Isomorphism is possible within groups but not between groups.

Non-isomorphism II

There are bijections between the vertex sets of these graphs (the sets are the same size)

There aren’t any edge-preserving node bijections because the edge-sets have different sizes (the incidence matrices have different numbers of 1’s in them - so the matrices can’t be the same)

1. 11.

Edge set size under IM

If G1 and G2 are isomorphic

then E(G1) and E(G2) have equal size

If E(G1) and E(G2) are different sizes

then G1 and G2 are not isomorphic

2121 GEGEGG

2121 GGGEGE

Edge set size conjecture

If E(G1) and E(G2) have equal size

then G1 and G2 are isomorphic

BEWARE - this is false!!counterexample?

Edge set size conjecture

If E(G1) and E(G2) have equal size

then G1 and G2 are isomorphic

BEWARE - this is false!!4.5.

same sized edge sets but not isomorphic

Grouping by edge set size

Group the graphs by edge-set size. Isomorphim is possible within groups but not between groups.

Grouping by edge set size

2.

3.

4.

1.6.

7.

8.

5.

9.10.

11. 12.

Group the graphs by edge-set size. Isomorphim is possible within groups but not between groups.

Grouping by node/edge set size

Group the graphs by node-set and edge-set size. Isomorphim is possible within but not between groups.

Grouping by node/edge set size

2.

3. 4.

1.6.

7.

8.

5.

9.

10.

11.

12.

Group the graphs by node-set and edge-set size. Isomorphim is possible within but not between groups.

Conjecture

• If two graphs have the same number of vertices and the same number of edges then the graphs are isomorphic

BEWARE - this is false!!

counterexample?

Conjecture

• If two graphs have the same number of vertices and the same number of edges then the graphs are isomorphic

BEWARE - this is false!!same sized vertex sets and edge sets but not isomorphic

The degree of a vertex

The degree of a vertex in a graph is the number of edges which meet that vertex

You can work out the degree from an adjacency matrix - how?

evGEev |)()deg(

The degree sequence of a graph

The degree sequence of a graph is an ordered list of the degrees of its vertices

<1, 2, 2, 2, 3>

You can work out the degree sequence from an adjacency matrix - how?

Grouping by degree sequence

2.

3. 4.

1.

6.

7.

8.

5.

9.

10.

11.

12.

{1, 1} {2, 2, 2}{1, 1 ,1 ,3}

{1, 1, 2, 3, 3} {2, 2, 2, 2, 4}

{1, 1, 1, 1, 3, 3}

{1, 1, 1, 1, 4}

Degree sequence under IM

If G1 and G2 are isomorphic

then they have equal degree sequences

If G1 and G2 have different degree sequences

then they are not isomorphic

The degree sequence game

1. Draw a graph

(limit it to six vertices to start with)

2. Work out its degree sequence.

3. Challenge someone else to draw your graph by telling them the degree sequence.

Are your graphs isomorphic?

Degree sequence conjecture

If G1 and G2 have equal degree sequences

then G1 and G2 are isomorphic

BEWARE - this is false!!counterexample?

Degree sequence conjecture

If G1 and G2 have equal degree sequences

then G1 and G2 are isomorphic

BEWARE - this is false!! same sized vertex sets, edge sets and same degree sequence but not isomorphic

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

• A cycle in a graph is a sequence of edges which “follow on from each other” and “end where they start”.

• Don’t allow use of the same edge twice.

Cycles and trees

A cycle in graph G is a sequence of edges

where the edges are distinct

13221 ,,..,,,, vvvvvv s

Cycles and trees

• Connected graphs which have no cycles are called trees.

• disconnected graphs without cycles are called forests!

A surprisingly hard question:

How many trees can you draw with n vertices? Write this as a function of n.

N. B. whenever anyone says “how many?” referring to graphs, they mean “how many, treating isomorphic graphs as the same?”

try it for n = 3? n = 4?

Electronic resource for graphs (and any dynamic geometry…)

Download Euklid free from

http://www.zdnet.com/downloads/

(type Euklid in the search box to get started)