Top Banner
It's a world-wide webby wonderland. Graphs
20

It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Jan 13, 2016

Download

Documents

Gillian Berry
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

It's a world-wide webby wonderland.

Graphs

Page 2: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Why?

• Graphs are often used to represent real-world information and real-world structures.

• Graph Theory was even invented to solve a real-world problem.– The city of Kӧnigsberg was located on the Pregel river in Prussia.

The river divided the city into four separate landmasses, including the island of Kneiphopf.

– These four regions were linked by seven bridges. Residents of the city wondered if it were possible to leave home, cross each of the seven bridges exactly once, and return home.

– Leonhard Euler (a mathematician) and solved it by converting it into a graph

Page 3: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Example

Page 4: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.
Page 5: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.
Page 6: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Essential Information

Page 7: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Example: Air routes

Page 8: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Other examples

• Some courses have pre-requisites. Are there any courses at UW-L that can't be taken because they are pre-requisites to each other (even indirectly via a third course)?

• Construct a schedule for building a house. what are the most critical (in terms of time) parts of the construction?

• Send a signal from your cell phone to your friends cell phone in Taiwan.

• Download a web page from Russia.• Whats the best NFL/MLB team?

Page 9: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Graph

VertexArc

Page 10: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Basic terms• A vertex is a node in the graph• An arc is a an ordered pair of vertices

– The arc might connect one vertex to itself.– The arc is one-way (FROM, TO)

• When drawn, a vertex is usually a circle (dot) and an arc is a line between the circles where the directionality is given by an arrow.

• A graph G consists of a set of vertices V and a set of arcs E. For example:– Let G = (V, E)– where V = {1,2,3,4,5,6}– and E = {{1,2}, {1,5}, {2,3}, {2,5}, {3, 4}, {4, 5}, {4, 6}}

Page 11: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Models and Views• A model is an abstract description of a system. A graph is a

mathematical model.– G = ({a,b,c,d,e}, {(a,c), (a,b), (c,b), (c,e), (d,b), (d,d), (e,d)})

• A view is a way to visualize a system or part of a system. A drawing of the model is a view.

• For one model, there may be many views.

Page 12: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

• Vertex A is adjacent to vertex B iff (A,B) is in E.• A loop is when a vertex is listed first and last in an arc.• The in-degree of a vertex V is the count of arcs of the form (_, V).

The number of arcs TO the vertex• The out-degree of a vertex V is the count of arcs of the form (V, _).

The number of arcs FROM the vertex• The order of a graph is the number of vertices• The size of a graph is the number of arcs

Terminology

G = ({a,b,c,d,e}, {(a,c), (a,b), (c,b), (c,e), (d,b), (d,d), (e,d)})

Page 13: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

• A path is a sequence of vertices [V1, V2, V3, V3, …, Vn] such that– For every pair of adjacent vertices Vi and Vj in the path, there is an arc (Vi,

Vj) in the graph.

• The length of a path is the number of arcs in the path. The length can be zero for the case of a single vertex.

• Vertex Vj is connected to vertex Vi iff there is at least one path that starts at Vi and ends at Vj

• A cycle is a path where– length > 0 – It starts and ends with the same vertex

• A graph with no cycles is acyclic.

Terminology (Paths)

Page 14: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

• Define G• Give the size and order of G.• Is [F, E, C, D] a path?

– length?– weight?

• What is the degree of E? Of A?• Is H connected to A?• Is A connected to H?

Example

Page 15: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Trees : a Special Kind of Graph• A tree is a graph such that

– It has one vertex with in-degree 0. This vertex is known as the 'root'.– Each non-root vertex has an in-degree of 1– There is a path from the root to every other vertex

Page 16: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Trees : a Special Kind of Graph

• Some vertices have an out-degree of zero. These vertices are called leaves. There may be many leaves in the tree.

• A tree is an acyclic graph.

Page 17: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Organizational Chart

Page 18: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Taxonomies

Page 19: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

Decision trees

Page 20: It's a world-wide webby wonderland.. Graphs are often used to represent real-world information and real-world structures. Graph Theory was even invented.

File System