1 12/2/2015 math 224 – discrete mathematics formally a graph is just a collection of unordered or...

22
1 06/20/22 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b V. Here G is the graph and V is called the set of nodes. So a graph G(V, E) is a set of objects V (of any type), which are called nodes or sometimes vertices. And E is actually the set of pairs, which are called edges or sometimes called links. The edges may be unordered pairs {a,b} or ordered pairs (a,b). With unordered pairs {a,b} and {b, a} are equivalent. But with ordered pairs the order matters so (a,b) is not the same as (b,a). Graphs

Upload: anthony-harold-lucas

Post on 13-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

104/18/23

MATH 224 – Discrete Mathematics

Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b V. Here G is the graph and V is called the set of nodes.

So a graph G(V, E) is a set of objects V (of any type), which are called nodes or sometimes vertices. And E is actually the set of pairs, which are called edges or sometimes called links.

The edges may be unordered pairs {a,b} or ordered pairs (a,b). With unordered pairs {a,b} and {b, a} are equivalent. But with ordered pairs the order matters so (a,b) is not the same as (b,a).

Graphs

Page 2: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

204/18/23

MATH 224 – Discrete Mathematics

Undirected Graph

0 1

3 4

2

5

Edges = {{0,2}, {1,2}, {1,3}, {1,4}, {2,4}, {2,5}, …}

Page 3: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

304/18/23

MATH 224 – Discrete Mathematics

Directed Graph

0 1

3 4

2

5

Edges = {(0,2), (1,2), (3,1), (1,4), (2,4), (4,2), …}

Page 4: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

404/18/23

MATH 224 – Discrete MathematicsSimple Graphs

Multiple edges between pairs of nodes and self loops are not allowed in simple graphs.

0 1

3 4

2

5

Multiple Edges

Self Loop

Page 5: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

504/18/23

MATH 224 – Discrete MathematicsPaths

0 1

3 4

2

5

Paths are a sequence of nodes, e.g., 0, 2, 5, 3, where no node is repeated and consecutive nodes correspond to an edge.

Page 6: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

604/18/23

MATH 224 – Discrete MathematicsNot a Path (called a walk)

0 1

3 4

2

5

Note that some nodes are repeated: 1, 2, 4, 1, 3, 5

Page 7: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

704/18/23

MATH 224 – Discrete MathematicsCycle

0 1

3 4

2

5

A cycle is a sequence of nodes, e.g., 1, 2, 4, 5, 3, 1, where consecutive nodes correspond to an edge and the only node that is repeated is the first and last node.

Page 8: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

804/18/23

MATH 224 – Discrete MathematicsCycle Graph

0 3

1 2

5 4

A cycle graph consists of a single cycle.

Page 9: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

904/18/23

MATH 224 – Discrete Mathematics

Trees

0 1

3 4

2

5

Trees are acyclic (no cycles) graphs that are connected (a path between every pair of edges). In an N node tree, how many edges are there?

Page 10: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1004/18/23

MATH 224 – Discrete Mathematics

Not a Tree

0 1

3 4

2

5

Cycle

Page 11: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1104/18/23

MATH 224 – Discrete Mathematics

Not a Tree

0 1

3 4

2

5

Cycle

This graph is not a tree because it has a cycle and is not connected. There is no path between 0 and 4 for example. What other pairs of nodes are not connected?

Page 12: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1204/18/23

MATH 224 – Discrete Mathematics

Not a Tree

0 1

3 4

2

5

6

A graph with two components. Two subgraphs that are connected. What are the nodes in each component?

Page 13: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1304/18/23

MATH 224 – Discrete Mathematics

Isomorphic Graphs

0 1

3 4

2

5

Two graphs are called isomorphic if they are the same if renaming the nodes will result in identical graphs.

Vertex 1 Corresponds to Vertex 4

0 1

3 4

2

5

Page 14: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1404/18/23

MATH 224 – Discrete Mathematics

Isomorphic Graphs ?

0 1

3 4

2

5

0 1

3 4

2

5

Are these two graphs isomorphic?

Graph A Graph B

Page 15: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1504/18/23

MATH 224 – Discrete Mathematics

0 1

3 4

2

5

0 1

3 4

2

5

Graph A Graph B2 1

3 0

4

5

Graph B with node 4 moved to the upper right, 2 moved to the upper center and 0 moved to the lower center position. Now Graphs A and B look the same except for labeling.

Are these two graphs isomorphic? Yes!

Graph B’s nodes have been moved to show the isomorphism.

Page 16: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1604/18/23

MATH 224 – Discrete MathematicsGraph Properties - Degree

The degree of a node in an undirected graph is the number of edges incident to that node.

0 1

3 4

2

5

What is the degree of node4? Of node 0? Of node 2?

Page 17: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1704/18/23

MATH 224 – Discrete MathematicsGraph Properties – Complete Graphs

How is the degree of a graph related to the number of edges?

The minimum number of edges in a graph is 0. A graph with the maximum number of edges is called a complete graph. The graph below is a complete undirected graph with four nodes.

What is the degree of each node in an N node complete Graph?

What is the sum of the degrees in an N node complete Graph?

How many edges are there in an N node complete Graph?

Page 18: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1804/18/23

MATH 224 – Discrete MathematicsGraph Properties – Bipartite Graphs

Bipartite graphs are graphs whose nodes can be divided into two disjoint sets, called partitions, in which there are no edges between nodes within a partition.

A complete bipartite graph has all possible edges. So for example, if one partition has K nodes and the other has M nodes, nodes in the K node partition will have degree M and the nodes in the M node partition will have degree K.

How many edges will there be in a complete bipartite graph with partitions of size K and M?

Page 19: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

1904/18/23

MATH 224 – Discrete MathematicsGraph Properties – Bipartite Graphs

Bipartite graphs have a number of interesting properties. For example, any cycle in a bipartite graph must have an even number of edges. Note the cycle in red below (0,4,3,5,0).

0 1 2 3

4 5

Page 20: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

2004/18/23

MATH 224 – Discrete MathematicsGraph Properties – Hypercube

Hypercubes have interesting properties that make them useful for some forms of parallel computing. The text illustrates hypercubes for n = 1, 2, 3 on Page 549. The figure below illustrates a 4-cube.

How many nodes are in an n-cube for n > 0? How many edges?

Page 21: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

2104/18/23

MATH 224 – Discrete MathematicsGraph Properties – Planar Graphs

Planar graphs are graphs that may be drawn on a 2-dimensional plane without having any of the edges intersect. Below are several planar graphs that are also complete graphs.

Try to draw a complete 5 node graph without having any edges intersect.

Can you do that?

Page 22: 1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b

2204/18/23

MATH 224 – Discrete MathematicsGraph Properties – Planar Graphs

A complete 5 node graph is not planar. Planar graphs are important in circuit board design. With a single layer circuit board the graph needs representing the circuit needs to be planar so that traces do not intersect. In order to build more complicated circuits multiple layer boards are often needed. In order to connect the edge in red to node a it will have to cross one or more of the other edges unless it is allowed to go outside of the plane.

a