Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphs and Trees This handout: Terminology of Graphs Applications of Graphs.

Similar presentations


Presentation on theme: "Graphs and Trees This handout: Terminology of Graphs Applications of Graphs."— Presentation transcript:

1 Graphs and Trees This handout: Terminology of Graphs Applications of Graphs

2 The process of mathematical reasoning We considered the first three types of mathematical objects Next: Graphs, their properties and applications numbers sets functions graphs Mathematical objects Derive properties, get applications Using the tools of logical reasoning

3 Terminology of Graphs A graph (or network) consists of – a set of points – a set of lines connecting certain pairs of the points. The points are called nodes (or vertices). The lines are called arcs (or edges or links). Example:

4 Graphs in our daily lives Transportation Telephone Computer Electrical (power) Pipelines Molecular structures in biochemistry

5 Terminology of Graphs Each edge is associated with a set of two nodes, called its endpoints. Ex: a and b are the two endpoints of edge e An edge is said to connect its endpoints. Ex: Edge e connects nodes a and b. Two nodes that are connected by an edge are called adjacent. Ex: Nodes a and b are adjacent. a b c e f

6 Terminology of Graphs: Paths A path between two nodes is a sequence of distinct nodes and edges connecting these nodes. Example: Walks are paths that can repeat nodes and arcs. a b

7 A little history: the Bridges of Koenigsberg “Graph Theory” began in 1736 Leonhard Eüler –Visited Koenigsberg –People wondered whether it is possible to take a walk, end up where you started from, and cross each bridge in Koenigsberg exactly once

8 The Bridges of Koenigsberg A D C B 12 4 3 7 6 5 Is it possible to start in A, cross over each bridge exactly once, and end up back in A?

9 The Bridges of Koenigsberg A D C B 12 4 3 7 6 5 Translation into a graph problem: Land masses are “nodes”.

10 The Bridges of Koenigsberg 12 4 3 7 6 5 Translation into a graph problem : Bridges are “arcs.” A C D B

11 The Bridges of Koenigsberg 12 4 3 7 6 5 Is there a “walk” starting at A and ending at A and passing through each arc exactly once? Such a walk is called an eulerian cycle. A C D B

12 Adding two bridges creates such a walk A, 1, B, 5, D, 6, B, 4, C, 8, A, 3, C, 7, D, 9, B, 2, A 12 4 3 7 6 5 A C D B 8 9 Here is the walk. Note: the number of arcs incident to B is twice the number of times that B appears on the walk.

13 Existence of Eulerian Cycle 12 4 3 7 6 5 A C D B 8 9 The degree of a node is the number of incident arcs 6 4 4 4 Theorem. An undirected graph has an eulerian cycle if and only if (1) every node degree is even and (2) the graph is connected (that is, there is a path from each node to each other node).

14 Graph properties Definition: The total degree of a graph is the sum of the degrees of all its nodes. Theorem: If G is any graph, then the total degree of G equals twice the number of edges of G: the total degree of G = 2 (the number of edges of G) Corollary 1: The total degree of a graph is even. Corollary 2: In any graph there are an even number of vertices of odd degree. Application to an Acquaintance Graph: Is it possible in a group of five people for each to be friends with exactly three others?

15 Terminology of Graph: Paths A path between two nodes is a sequence of distinct nodes and edges connecting these nodes. Example: Two nodes are called connected if there is a path between them. Fact: For any two nodes a and b of a graph, there is an efficient way to determine whether a and b are connected or not. a b

16 An application of graphs in solving a puzzle  From an initial position on the left bank of a river, a ferryman wants to transport a wolf, a goat, and a cabbage to the right bank. Ferryman’s boat is only big enough to transport one object at a time, other than himself. For obvious reasons, the wolf cannot be left alone with the goat; the goat cannot be left alone with the cabbage.  How should the ferryman proceed?

17 An application of graphs in solving a puzzle To solve the puzzle, create the following graph:  Create a node for each allowable arrangement. E.g., ( fg | wc ) is an allowable arrangement since the ferryman and the goat are on the left bank, and the wolf and the cabbage are on the right bank.  Create an edge between two nodes if it is possible to go from the arrangement of one node to the arrangement of the other node by a single ferry trip. E.g., there is an arc between nodes ( fgw | c ) and ( w | fgc ) because the transition from the first node to the second node can be realized by a single trip of the ferryman with the goat from the left bank to the right bank.

18 An application of graphs in solving a puzzle The resulting graph is: To transport everything from the left bank to the right bank, we need to find a path from node ( fwgc | ) to node ( | fwgc ) in the graph. There are two this kind of paths. One of them: (fwgc | )  (wc | fg)  (fwc | g)  (w | fgc)  (fwg | c)  (g | fwc)  (fg | wc)  ( | fwgc) fwgc |fwg | cfwc | g fgc | wfg | wc wc | fgw | fgcg | fwc c | fwg| fwgc


Download ppt "Graphs and Trees This handout: Terminology of Graphs Applications of Graphs."

Similar presentations


Ads by Google