<<

Graphs and

Backyards of Old Houses in Antwerp in the Snow Van Gogh Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois • Proof techniques: • Discrete structures: – Direct – Numbers – Contrapositive – Sets, functions, rels – Disproving – Graphs – Induction – Trees – Contradiction – Pigeon-hole principle – 2-way bounding

2 Fastest from Chicago to Bloomington? Fastest path from Chicago to Bloomington? Fastest path from Chicago to Bloomington?

start

2 1 3

4 Fastest path from Chicago to Bloomington?

start C

2 1 20 30 4 15 1 2

120 35

3 110 4

60 90

end B

3 Other applications of graphs • Modeling the flow of a network – Traffic, water in pipes, bandwidth in computer networks, etc.

7 Basics of graphs

Graph = (V, E) Terminology: vertex/node, edge, neighbor/adjacent, directed vs. undirected, simple graph, degree of a node

8 overhead 9 Degrees and handshaking theorem

Loops count twice

10 overhead Types of graphs

퐾푛: complete graph with 푛 nodes

How many edges does each type have? 11 overhead Types of graphs

퐶푛: cycle graph with 푛 nodes

푊푛: wheel graph with 푛 + 1 nodes

How many edges does each type have? 12 overhead Subgraphs

13

An isomorphism from 퐺1 = (푉1, 퐸1) to 퐺2 = (푉2, 퐸2) is a 푓: 푉1 → 푉2 such that any pair of nodes 푎 and 푏 are joined by an edge iff 푓(푎) and 푓 푏 are joined by an edge

Two graphs are isomorphic if there is an isomorphism between them

14 overhead Isomorphism examples

An isomorphism from 퐺1 = (푉1, 퐸1) to 퐺2 = (푉2, 퐸2) is a bijection 푓: 푉1 → 푉2 such that any pair of nodes 푎 and 푏 are joined by an edge iff 푓(푎) and 푓 푏 are joined by an edge

15 overhead Isomorphism examples

An isomorphism from 퐺1 = (푉1, 퐸1) to 퐺2 = (푉2, 퐸2) is a bijection 푓: 푉1 → 푉2 such that any pair of nodes 푎 and 푏 are joined by an edge iff 푓(푎) and 푓 푏 are joined by an edge

16 overhead 17 Necessary but not sufficient requirements for two graphs to be isomorphic

18 overhead Requirements for two graphs to be isomorphic

• Same number of nodes and edges

• Same number of nodes of degree 푘

• Every subgraph in one must have a ``matching’’ subgraph (isomorphic subgraph) in the other

19 Isomorphism is an equivalence : reflexive, symmetric, and transitive

20 Automorphism: an isomorphism from a graph to itself

• Automorphisms identify symmetries in the graph

• How many different automorphisms?

퐶4

21 overhead Bridges of Konigsberg

Possible to cross all bridges exactly one and end up where you started?

First theorem of graph theory!

22 source: http://en.wikipedia.org/wiki/File:Konigsberg_bridges.png Terminology of walks walk: sequence of connected nodes/edges closed walk: start and end point are the same path: walk with no node used more than once

b c f a

d e 23 overhead Terminology of walks cycle: closed walk with 3+ nodes, no nodes except the first/last used more than once acyclic: graph without cycles

Euler circuit: closed walk that uses each edge exactly once b c f a

d e 24 overhead Bridges of Konigsberg

Possible to cross all bridges exactly one and end up where you started?

25 overhead Connected graphs

26 More connectivity terminology

The distance of two nodes is the minimum number of edges that forms a walk from one node to the other.

The diameter of a graph is the maximum distance between any two nodes in a graph.

27 More connectivity terminology

A graph is connected if there is a walk between any two nodes.

A connected component is a of nodes that are connected to each other but not connected to any other nodes.

28 overhead Connected components

In fact, define u R v iff there is a walk from u to v.

R is reflexive, symmetric, and transitive…. an equivalence relation.

The equivalence classes of R are….

29 Bipartite graphs

• A graph G=(V,E) is bipartite if we can partition the of vertices into two (disjoint) sets V1 and V2 such that all edges are between a vertex in V1 and a vertex in V2 (i.e., no edge should be between two vertices of V1, and no edge should be between two vertices of V2).

30 k-colorability • A graph is k-colorable if you can assign a color from {1, … k} to every vertex such that every pair of adjacent vertices get different colors.

31 2-colorability and bipartite • A graph is 2-colorable iff it is bipartite.

32 Colorability Every graph with maximum degree k is (k+1)- colorable.

33 34