FUNDAMENTAL CONCEPTS Graph Theory Fundamental Concept 1 Graph Theory.
Introduction to Graph Theory - Matrix Analysis · Graph Theory - An Introduction Definition...
Transcript of Introduction to Graph Theory - Matrix Analysis · Graph Theory - An Introduction Definition...
Introduction to Graph Theory
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk Introduction to Graph Theory
A problem to solve
A map of Searcy....
Dr. James Burk Introduction to Graph Theory
A problem to solve
A UPS driver has ten stops to make....
Dr. James Burk Introduction to Graph Theory
A problem to solve
15 possible roads to take between stops....
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
A problem to solve
Is it possible to visit each stop exactly once ??
Dr. James Burk Introduction to Graph Theory
A problem to solve
Can we determine the cheapest route for the driver to travel, if weknew the distances (or costs) of each of these roads?
Dr. James Burk Introduction to Graph Theory
Graph Theory - An Introduction
Graph Theory is a branch of mathematics with applications to:
computer science
optimization theory
linguistics
chemistry
biology
and many many others ...
Dr. James Burk Introduction to Graph Theory
Graph Theory - An Introduction
DefinitionA graph is a collection of points called vertices and lines callededges that connect some of the vertices.
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Graph Theory - An Introduction
DefinitionA graph is a collection of points called vertices and lines callededges that connect some of the vertices.
Dr. James Burk Introduction to Graph Theory
Graph Theory - An Introduction
DefinitionA graph is a collection of points called vertices and lines callededges that connect some of the vertices.
Dr. James Burk Introduction to Graph Theory
Graph Theory - An Introduction
DefinitionA graph is a collection of points called vertices and lines callededges that connect some of the vertices.
Dr. James Burk Introduction to Graph Theory
Graph Theory - Some Properties
Each vertex has a number associated to it called its degree:
DefinitionThe degree of a vertex is the number of edges attached to thatvertex.
Example: What is the degree of each vertex in these graphs?
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Graph Theory - Some Properties
Something to note about graphs and the degrees of vertices:
Each edge has two ends.
And each of these two ends contributes to the degree of a vertex.
So the total of the degrees of all the vertices must be twice thenumber of edges in the graph.
Theorem (Sum of Degrees Theorem)
In any graph, the sum of the degrees of the vertices equals twice thenumber of edges.
Dr. James Burk Introduction to Graph Theory
Graph Theory - Some Properties
Any graph is either connected or disconnected.
DefinitionA graph is connected if any two vertices are connected by a series ofedges. If not, the graph is disconnected.
We’ll see some examples a little later today.
Dr. James Burk Introduction to Graph Theory
Graph Theory - Some Properties
Some graphs are the “same” even though they aren’t drawn in exactlythe same way.
Consider these graphs:
We say these graphs are isomorphic.
Dr. James Burk Introduction to Graph Theory
Graph Theory - Some Properties
Some things to note here:
The length of each edge doesn’t matter.
Edges don’t have to be straight.
The arrangement of vertices often doesn’t matter.
There could be more than one edge between vertices – thisdepends on the context of the graph.
Just because edges are drawn so that they intersect doesn’tmean that there is a vertex at their intersection.
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Graph Theory - An example
Suppose you have several computers and printers that need to beconnected to a server and form a network:
Dr. James Burk Introduction to Graph Theory
Graph Theory - An example
Suppose you have several computers and printers that need to beconnected to a server and form a network:
Dr. James Burk Introduction to Graph Theory
Graph Theory - An example
Suppose you have several computers and printers that need to beconnected to a server and form a network:
Dr. James Burk Introduction to Graph Theory
Graph Theory - An example
Suppose you have several computers and printers that need to beconnected to a server and form a network:
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Graph Theory - Another Example
There are three student organizations on a very small campus: Math
club, Science club and Track.Amanda is a member of the Science club and Track, Brent is a
member of Math club, and Carla is a member of Math club and Track.
A
T
B
R
C
S
Dr. James Burk Introduction to Graph Theory
Graph Theory - Another Example
There are three student organizations on a very small campus: Math
club, Science club and Track.Amanda is a member of the Science club and Track, Brent is a
member of Math club, and Carla is a member of Math club and Track.
A
T
B
R
C
S
Dr. James Burk Introduction to Graph Theory
Graph Theory - Another Example
There are three student organizations on a very small campus: Math
club, Science club and Track.Amanda is a member of the Science club and Track, Brent is a
member of Math club, and Carla is a member of Math club and Track.
A
T
B
R
C
S
Dr. James Burk Introduction to Graph Theory
Graph Theory - Another Example
There are three student organizations on a very small campus: Math
club, Science club and Track.Amanda is a member of the Science club and Track, Brent is a
member of Math club, and Carla is a member of Math club and Track.
A
T
B
R
C
S
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Graph Theory - Another Example
Any set of information that can be presented in a table can berepresented by a graph. For example:
# flights Houston Chicago Miami Conroe LA WillisHouston - 2 1 0 2 0Chicago 2 - 1 0 1 0Miami 1 1 - 0 2 0
Conroe 0 0 0 - 0 2LA 2 1 2 0 - 0
Willis 0 0 0 2 0 -
H
Chi M
LA
W
Con
Dr. James Burk Introduction to Graph Theory
Graph Theory - Some History
The 18th century, in Konigsburg, Prussia.
There were 7 bridges in the city.
During a walk through the city, a question was asked:
Is it possible to leave home, cross each bridge exactly once, and thenreturn home?
Dr. James Burk Introduction to Graph Theory
Graph Theory - An Introduction
The “bridge problem” can be rephrased as:
Is it possible to start at one vertex, and “walk” along the edges sothat:
1 all edges are crossed exactly once, and2 the “walk” ends at the same vertex it started.
If this is possible, the graph is called an Eulerian graph, afterLeonard Euler (pronounced “Oiler”)
Dr. James Burk Introduction to Graph Theory
Exercises – page 1 of 2
1 For each graph below, find the number of edges, the number ofvertices, the degree of each vertex. Verify that the “Sum ofDegrees Theorem” is true for each graph.
(a.) The so-called “House-X” graph
(b.) The Petersen graph
(c.) A Dorogovtsev-Goltsev-Mendes graph
Dr. James Burk Introduction to Graph Theory
Notes
Notes
Notes
Notes
Exercises – page 2 of 2
2 Draw a graph with 6 vertices and 12 edges.3 State a few instances where drawing or using a graph might be
necessary or useful.4 Are these graphs isomorphic? Why or why not?
5 Are these graphs isomorphic? Why or why not?
Dr. James Burk Introduction to Graph Theory
Eulerian Graphs
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk Eulerian Graphs
Eulerian graphs
DefinitionA graph is said to be Eulerian if there is a path starting and ending atthe same vertex that uses each edge exactly once.
This path is then called an Euler circuit.
This has many practical applications:
snow plow routes
computer chip architecture
any application where complete coverage & efficiency are needed
Dr. James Burk Eulerian Graphs
Eulerian graphsSo, how do we know if a given graph is Eulerian?
First, a reminder of two definitions:
DefinitionFor any vertex, its degree is the number of edges at that vertex.
Example:
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Eulerian graphs
DefinitionA graph is connected if any vertex can be reached from any othervertex through some edges.
Example:
Dr. James Burk Eulerian Graphs
Eulerian graphs
DefinitionA graph is connected if any vertex can be reached from any othervertex through some edges.
Example:
Dr. James Burk Eulerian Graphs
Eulerian graphs
Examples: Do any of these three graphs possess an Euler circuit?
So, we are now ready for the first theorem in Graph Theory:
Theorem (Euler Circuit Theorem)
A connected graph is Eulerian when every vertex has even degree.
Dr. James Burk Eulerian Graphs
Eulerian graphs
But this last one should be familiar: it’s the graph representing theKonigsburg bridges!
So, since this graph is not Eulerian, there is no way to traverse allseven bridges exactly once, ending where you start.
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Eulerian graphs
Theorem (Euler Circuit Theorem)
A connected graph is Eulerian when every vertex has even degree.
This theorem only says an Euler circuit exists. It doesn’t tell us how tofind it.
If we use this theorem to determine there is an Euler circuit, how dowe find it?
Dr. James Burk Eulerian Graphs
Finding Euler Circuits
There is an algorithm (a list of steps) that will find an Euler circuitwithin a graph.
But first, a definition:
DefinitionIf a connected graph contains an edge that, when removed, causesthe graph to be disconnected, that edge is called a cut edge.
Dr. James Burk Eulerian Graphs
How to find Euler circuits
Fleury’s Algorithm
1 Start at any vertex. Walk along any edge to another vertex,(temporarily) removing this edge.
2 From this vertex, walk along any edge to another vertex,trying to avoid a cut edge. Remove this edge as well.
3 Repeat step 2 until all edges have been removed (walked on)and the walk ends at the starting vertex.
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Here’s a graph: it’s Eulerean, so there must be an Euler circuit
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Fleury’s Algorithm – an example
Let’s label the vertices so that it’s easier to find an Euler circuit:
A
F
E
D
C
B
Let’s find an Euler circuit starting at vertex E.
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from E to B (not a cut edge):
A
F
E
D
C
B
E→ B
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from B to F (a cut edge, but no other choice):
A
F
E
D
C
B
E→ B→ F
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from F to A (not a cut edge):
A
F
E
D
C
B
E→ B→ F→ A
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Fleury’s Algorithm – an example
Remove the edge from A to C (a cut edge, but no other choice):
A
F
E
D
C
B
E→ B→ F→ A→ C
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from C to F (not a cut edge):
A
F
E
D
C
B
E→ B→ F→ A→ C→ F
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from F to E (a cut edge, but no other choice):
A
F
E
D
C
B
E→ B→ F→ A→ C→ F→ E
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from E to C (not a cut edge):
A
F
E
D
C
B
E→ B→ F→ A→ C→ F→ E→ C
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Fleury’s Algorithm – an example
Remove the edge from C to D (a cut edge, but no other choice):
A
F
E
D
C
B
E→ B→ F→ A→ C→ F→ E→ C→ D
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm – an example
Remove the edge from D to E (not a cut edge):
A
F
E
D
C
B
E→ B→ F→ A→ C→ F→ E→ C→ D→ E
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm
Things to notice about Fleury’s algorithm:
We found an Euler circuit starting at vertex E.
E→ B→ F→ A→ C→ F→ E→ C→ D→ E
We could use this to find one starting at any other vertex, forexample:
A→ C→ F→ E→ C→ D→ E→ B→ F→ A
This algorithm could be used to find many other Euler circuits!They are not unique!
Dr. James Burk Eulerian Graphs
Fleury’s Algorithm
Another example: use Fleury’s algorithm to find the Euler circuit in thegraph below
A
F
E D
B
G C
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Eulerian Walks
What if, given a graph, we are interested in traversing all edges, butwe don’t care if the starting and ending points are the same?
DefinitionAn Euler walk is a path that uses each edge exactly once, but endsat a point different from its starting point.
Example:
Dr. James Burk Eulerian Graphs
Eulerian Walks
Theorem (Euler Walk Theorem)
A connected graph contains an Euler Walk when all but two verticeshave even degree.
– that is, two with odd degree, and the rest with even degree.
The Euler walk will begin and end at the vertices with odd degree.
Dr. James Burk Eulerian Graphs
Eulerian Walks
Example: A campground has 7 campsites, with 11 bike trails.
Is it possible to start at one campground, bike each trail once, andend at the same campground? NOIs it possible to start at one campground, bike each trail once, andend at another campground? YES
Dr. James Burk Eulerian Graphs
Homework – page 1 of 2
1 Is it possible to leave one city, travel all the roads exactly once,and return to the starting city? Why or why not?
Dover
Evanston
Caldwell
Fairmont
Burley
Alameda
Grange
2 Does the graph below contain an Euler walk? Why or why not? Ifit does, find one.
Dover
Evanston
Caldwell
Fairmont
Burley
Alameda
Grange
Dr. James Burk Eulerian Graphs
Notes
Notes
Notes
Notes
Homework – page 2 of 2
3 Does the graph below contain an Euler circuit? Why or why not?If it does, find one.
A C
B
GF D
E
4 Use fleury’s algorithm to find an Euler circuit (starting at vertex A)in the graph below:
Dr. James Burk Eulerian Graphs
Hamiltonian Graphs
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk Hamiltonian Graphs
Another problem
When a graph represents locations (cities, intersections, houses,etc.), and routes between these locations, we usually let:
vertices represent the locations, and
edges represent the roads between these locations.
If the graph contains an Euler circuit or an Euler walk, all edges canbe traversed exactly once.
That is, each road could be traveled exactly one time.
What if we want to visit each city exactly once, regardless of howmany times each road is traveled?
Dr. James Burk Hamiltonian Graphs
Hamiltonian graphs
DefinitionA graph is Hamiltonian if there is a circuit that passes through eachvertex exactly once.
This path is called a Hamiltonian circuit
Warning: Just like Eulerian graphs, the Hamiltonian circuit (if it exists)is usually NOT unique!!
Examples:
Dr. James Burk Hamiltonian Graphs
Notes
Notes
Notes
Notes
Hamiltonian Graphs
Another example: here’s a map of the regions of Ireland
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Is it possible to leave one region, visit each region exactly once, andreturn to the starting point?
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Is it possible to leave one region, visit each region exactly once, andreturn to the starting point?
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Is it possible to leave one region, visit each region exactly once, andreturn to the starting point?
Dr. James Burk Hamiltonian Graphs
Notes
Notes
Notes
Notes
Hamiltonian Graphs
Is this graph Hamiltonian? YES!
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Why could this be important?
UPS scheduling, a special case of the Traveling Salesman Problem.
So, how do we know whether or not a given graph is Hamiltonian?
It looks like a graph will contain a Hamiltonian circuit if there areenough edges between vertices. More specifically,...
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Theorem (Hamilton Circuit Theorem)
Suppose we have a connected graph that has no multiple edges, andhas n vertices. If every vertex has degree at least n
2 , then the graph isHamiltonian.
Examples:
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Theorem (Hamilton Circuit Theorem)
Suppose we have a connected graph that has no multiple edges, andhas n vertices. If every vertex has degree at least n
2 , then the graph isHamiltonian.
Definition (Complete graphs)
A graph is complete if there is exactly one edge between every pairof vertices.
Examples:
Dr. James Burk Hamiltonian Graphs
Notes
Notes
Notes
Notes
Hamiltonian Graphs
A question to think about:
How many edges are in the complete graph with n vertices?
4 vertices: # of edges: 6 degree of each vertex: 35 vertices: # of edges: 10 degree of each vertex: 46 vertices: # of edges: 15 degree of each vertex: 57 vertices: # of edges: 21 degree of each vertex: 6
Dr. James Burk Hamiltonian Graphs
Hamiltonian Graphs
Why talk about complete graphs right now?
Because there are always more than enough edges to satisfy theHamilton Graph theorem:
Theorem (Hamilton Circuit Theorem)
Suppose we have a connected graph that has no multiple edges, andhas n vertices. If every vertex has degree at least n
2 , then the graph isHamiltonian.
So every complete graph is definitely Hamiltonian!!WARNING: This theorem only says a Hamiltonian circuit exists. Itdoesn’t tell us how to find it. So, how can we find them?
Dr. James Burk Hamiltonian Graphs
Finding Efficient Routes
We’ll actually do something much better.
In many contexts, the edges of a graph are defined in such a way thatsome edges are better (or worse) than others.
For example, a UPS driver might prefer to drive a shorter road than alonger road between cities.
We could keep track of these differences with a labeled graph.
Dr. James Burk Hamiltonian Graphs
Finding Efficient Routes
Example:
Many graphs will carry more information....
Dr. James Burk Hamiltonian Graphs
Notes
Notes
Notes
Notes
Finding Efficient Routes
Example:
Some Hamiltonian circuits are “better” than others.
How do we find the “best” Hamiltonian circuit?
Dr. James Burk Hamiltonian Graphs
Finding Efficient Routes
First, we’ll find the “best” Hamilton circuits within a complete graph(one in which all vertices are connected by exactly one edge.)
[Because of the Hamilton Graph Theorem, all complete graphs areHamiltonian!]
Wait: Isn’t this impractical? Not all graphs are complete!
We can make any graph complete, by adding edges, and labelingthese new edges with numbers that “make sense”.
Dr. James Burk Hamiltonian Graphs
Finding Efficient Routes
We’ll learn two algorithms:
the Greedy Algorithm and the Edge-Picking Algorithm.
They will both give us “efficient” Hamiltonian circuits in completelabeled graphs. Then, we choose the best one.
We could win $1 million!
Dr. James Burk Hamiltonian Graphs
Homework
1 Which of the graphs below contain an Euler circuit? An Eulerwalk? Are any of them Hamiltonian? Why or why not?
2 Is the graph below Hamiltonian? Why or why not? Can you findthe Hamilton circuit?
Dover
Evanston
Caldwell
Fairmont
Burley
Alameda
Grange
Dr. James Burk Hamiltonian Graphs
Notes
Notes
Notes
Notes
Homework
1 How many Hamilton circuits does the complete graph K4 belowcontain?
2 Draw the complete graph with 5 vertices. Find at least 2Hamilton circuits.
Dr. James Burk Hamiltonian Graphs
The Greedy Algorithm
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
The Greedy Algorithm – finding efficient Hamiltonian circuits incomplete graphs
1 Choose a vertex as a starting point, and travel along the edgethat has the smallest weight.
2 After arriving at the next vertex, travel along the edge of smallestweight that connects to a vertex that has not yet been visited.
3 Continue until all vertices have been visited.
4 Return to the starting vertex.
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Greedy Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Example:
Total “cost” or “weight”: 5 + 4 + 3 + 5 + 9 = 26
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
This Greedy Algorithm has this name because it has us choose the“cheapest” option at each chance we get.
The next algorithm uses a different strategy: choose the routes first,the vertices second.
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Greedy Algorithm
The Greedy Algorithm – finding efficient Hamiltonian circuits incomplete graphs
1 Choose a vertex as a starting point, and travel along the edgethat has the smallest weight.
2 After arriving at the next vertex, travel along the edge of smallestweight that connects to a vertex that has not yet been visited.
3 Continue until all vertices have been visited.
4 Return to the starting vertex.
Dr. James Burk The Greedy Algorithm
WARNING!!
Be careful – in the Greedy Algorithm, choosing a different startingpoint might give a different circuit!!
So, for a complete graph with 5 vertices, the Greedy Algorithm couldgive 5 different “efficient” Hamilton circuits!!
Monday’s worksheet gave an example of this!!
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
The Edge-Picking Algorithm – finding efficient Hamiltonian circuitsin complete graphs
1 Mark the edge that has the smallest weight.
2 Mark the edge of next-smallest weight, as long as it does notcomplete a circuit, and does not add a third marked edge to asingle vertex.
3 Continue until no more edges can be marked. That is, until allvertices have been used.
4 Return to the starting vertex.
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Edge-Picking Algorithm
Example:
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Example:
Total “cost” or “weight”: 5 + 4 + 3 + 5 + 9 = 26
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
For this labelled graph, both algorithms chose the same Hamiltoncircuit!
This will not always happen!
Dr. James Burk The Greedy Algorithm
Comparing algorithms
An example: miles driven running errands
Errand Home Post Office Grocery Video store BankHome – 14 12 20 23Post Office 14 – 8 12 21Grocery 12 8 – 17 11Video store 20 12 17 – 18Bank 23 21 11 18 –
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Greedy Algorithm
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Dr. James Burk The Greedy Algorithm
The Greedy Algorithm
Total “cost” or “weight”: 12 + 8 + 12 + 18 + 23 = 73
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Edge-Picking Algorithm
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
The Edge-Picking Algorithm
Dr. James Burk The Greedy Algorithm
The Edge-Picking Algorithm
Total “cost” or “weight”: 8 + 11 + 12 + 20 + 23 = 74
Dr. James Burk The Greedy Algorithm
Comparing Algorithms
Greedy Algorithm: Edge-Picking Algorithm:
Total cost = 73 Total cost = 74
Dr. James Burk The Greedy Algorithm
Non-complete labelled graphs
Now, what about finding efficient routes in non-complete graphs suchas:
We have a couple of options for making this graph complete:
Dr. James Burk The Greedy Algorithm
Notes
Notes
Notes
Notes
Non-complete labelled graphs
Depending on the context, we could:
Dr. James Burk The Greedy Algorithm
Non-complete labelled graphs
Or, we could:
Dr. James Burk The Greedy Algorithm
Trees
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk Trees
More with Graph Theory
One of these graphs is not like the others:
Dr. James Burk Trees
Notes
Notes
Notes
Notes
More with Graph Theory
DefinitionA tree is a connected graph that contains no circuits.
Examples:
TheoremIf a tree has n vertices, then it will have n − 1 edges.
Dr. James Burk Trees
More with Graph Theory
There is one very important fact about trees which we will takeadvantage of:
TheoremIn a tree, there is always exactly one way to get from each vertex toany other vertex without repeating any of the edges.
Dr. James Burk Trees
Finding trees inside a graph
Given any graph, can we find a tree inside that graph?
Here’s a graph:
It’s not a tree!
DefinitionA spanning tree for a graph is a tree “inside” the graph that includesevery vertex.
Dr. James Burk Trees
Finding trees inside a graph
DefinitionA spanning tree for a graph is a tree “inside” the graph that includesevery vertex.
Here’s a graph that is not a tree:
Two different spanning trees:
Dr. James Burk Trees
Notes
Notes
Notes
Notes
Finding trees inside a graph
DefinitionA spanning tree for a graph is a tree “inside” the graph that includesevery vertex.
Here’s another graph that is not a tree:
Two different spanning trees:
Dr. James Burk Trees
Finding trees inside a graph
So, given any graph, there may be many spanning trees inside thatgraph.
Before we go any further, let’s talk about why these might beimportant.
communication networks,
air conditioning ducts,
and cancer research:
Dr. James Burk Trees
Finding trees inside a graph
Dr. James Burk Trees
Finding trees inside a graph
Dr. James Burk Trees
Notes
Notes
Notes
Notes
Finding trees inside a graph
Minimum cost spanning tree situations and geneexpression data analysis
Stefano MorettiUnit of Molecular Epidemiology, National Cancer Research Institute (IST)
Largo R. Benzi 10, 16132Genoa, Italy
Telephone number:+39-(0)[email protected]
ABSTRACTIn [16] a methodology based on Game Theory for the anal-ysis of gene expression data is studied. Roughly speaking,the starting point is the observation of a ‘picture’ of gene ex-pressions in a sample of cells under a biological condition ofinterest, for example a tumor. Then, Game Theory plays aprimary role to quantitatively evaluate the relevance of eachgene in regulating or provoking the condition of interest, tak-ing into account the observed relationships in all subgroupsof genes. In this paper, an alternative model based on min-imum cost spanning tree representation of gene expressiondata has been introduced. One of the main characteristicsof this model is the possibility to avoid the dichotomizationtechnique required for microarray games introduced in [17].
Keywordsminimum costs spanning tree situation, cooperative gametheory, gene expression analysis, microarray
1. INTRODUCTIONGene expression occurs when genetic information con-
tained within DNA is transcripted into messenger ribonu-cleic acid (mRNA) molecules and then translated into theproteins. So, estimates of the amount of mRNA for a givengene yields a quantitative evaluation of the amount of pro-teins coded by that gene, that is its gene expression level.Nowadays, DNA microarray technology is available for tak-ing ‘pictures’ of gene expressions. Within a single experi-ment of this sophisticated technology, the ratio of expressionlevels of thousands of genes under two di!erent experimentalconditions can be estimated. The expression level of eachgene collected from a cell under a biological condition ofinterest (e.g. a tumor), can be compared to the expressionlevel of the same gene collected from a control cell (usuallyan healthy one), and the ratio of expression levels between
Permission to make digital or hard copies of all or part of this work forpersonal or classroom use is granted without fee provided that copies arenot made or distributed for pro£t or commercial advantage and that copiesbear this notice and the full citation on the £rst page. To copy otherwise, torepublish, to post on servers or to redistribute to lists, requires prior speci£cpermission and/or a fee.GameNets’06, October 14, 2006, Pisa, Italy.Copyright 2006 ACM 1-59593-507-X/06/10...$5.00
the two conditions can be computed for each gene. If k > 0experiments are performed, each gene i in the set of stud-ied genes N can be associated to a k-dimensional vector ofreal-valued ratio of expression levels, that we will refer asthe expression vector of gene i, for each i ! N .
In [17] the class of microarray games has been introduced.Via a dichotomization technique applied to gene expressiondata, it is constructed a game whose characteristic functiontakes values on the interval [0, 1]. The objective of sucha game is to stress the relevance (‘su"ciency’) of groups ofgenes in relation to a specific biological condition or responseof interest (e.g. a disease of interest). In that paper, it hasbeen discussed the possibility of applying game-theoreticaltools that can take into account the relationships which existamong genes, like the Shapley value. The highest Shapleyvalues of the game should point to the most influential genes,so that it could be useful as a hint for pointing at the genesthat mostly deserve further investigation.
Microarray games may be useful to describe the magni-tude of the association of a given biological condition of theoriginal cell (e.g. a tumor) with a given gene expression cate-gory (e.g., ‘abnormal expression’, ‘down regulation’, ‘strongvariability’ etc.) of genes realized in each coalition of genes,i.e. each subset of N . As we already mentioned, in order toset up a microarray game, the real-valued ratio of expressionlevels must firstly be turned into expression categories usingappropriate cuto!s on the continuous domain.
A key issue in the definition of microarray games is the op-erational definition of association between a gene expressioncategory and a biological condition realized in a nonemptycoalition S " N . Given a set of genes N collected from acell, the authors in [17] claimed that a su"cient conditionto realize in a nonempty coalition S " N the associationbetween the expression category and a biological conditionof the cell is that all the genes which present the expres-sion category belong to coalition S (su!ciency principle forgroups of genes). For example, if the expression categoryis ‘over expression’ and the biological condition of the cellis ‘tumor’, then the association between the tumor and theover expression category is realized in a coalition S " N ,S #= $, if all the over expressed genes in the tumor cell be-long to S. Subsequently, given a set of observed cells, themagnitude of the association is measured, in each coalitionS, as the observed frequency of associations realized in Saccording to the su"ciency principle. Following the exam-ple above, if a nonempty coalition of genes S " N contains
Dr. James Burk Trees
Finding trees inside a graph
So, how do we find a spanning tree inside a given graph?
Just like with Hamilton circuits, we’ll do something better:
We’ll find the best spanning tree in a graph with labeled edges.
This will be called the minimal spanning tree for the graph.
Dr. James Burk Trees
Minimal spanning trees
Example:
Find a spanning tree that has the minimal cost.
Dr. James Burk Trees
Minimal spanning trees
Example:
Cost: 10 + 4.5 + 1.5 + 9.5 + 3 = 28.5
Dr. James Burk Trees
Notes
Notes
Notes
Notes
Minimal spanning trees
Example:
Cost: 7 + 4.5 + 1 + 3 + 4 = 19.5
Dr. James Burk Trees
Minimal spanning trees
Luckily, we have an algorithm for finding mininal spanning trees.
Kruskal’s Algorithm – finding minimal spanning trees in a graph:
1 Choose any edge with smallest weight.
2 Choose the edge with the next smallest weight.
3 Continue choosing new edges with smallest weight, making surenot to create a circuit.
4 Repeat until all vertices have been visited.
Dr. James Burk Trees
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost:
Dr. James Burk Trees
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost: 1 +
Dr. James Burk Trees
Notes
Notes
Notes
Notes
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost: 1 + 1.5 +
Dr. James Burk Trees
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost: 1 + 1.5 + 3 +
Dr. James Burk Trees
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost: 1 + 1.5 + 3 + 4 +
Dr. James Burk Trees
Minimal spanning trees
Example: use Kruskal’s Algorithm to find a minimal spanning tree inthe following graph:
Total cost: 1 + 1.5 + 3 + 4 + 7 = 16.5
Kruskal’s algorithm will ALWAYS find the minimal spanning tree!!
Dr. James Burk Trees
Notes
Notes
Notes
Notes
Homework - page 1 of 2
1 How many edges are in a tree that has 15 vertices?2 How many vertices are in a tree that has 15 edges?3 Find all spanning trees in the following graph:
4 Find all spanning trees in the following graph:
Dr. James Burk Trees
Homework - page 2 of 2
4 Draw two different spanning trees from the following graph:
5 Use Kruskal’s Algorithm to find the minimal spanning tree insidethe following labeled graph. What is the “total cost”?
15
11
14
10 31
30
33 18
27
20
1223
Dr. James Burk Trees
Homework - page 2 of 2
6 Use Kruskal’s Algorithm to find the minimal spanning tree in thefollowing labeled graph. What is the “total cost”?
Dr. James Burk Trees
Planar Graphs
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Planar Graphs
Here’s a map of the counties of Ireland, before the Irish Civil War:
Note that adjacent counties have different colors. How many colorsare used?
Dr. James Burk Planar Graphs
Some applications of planar graphs
Here’s a map of the US (without Alaska or Hawaii):
Note that adjacent states have different colors. How many colors areused?
Dr. James Burk Planar Graphs
Map coloring
In both cases, only four colors were needed to color the regions of themaps.
Is there a map in which more than four colors would be needed?
Dr. James Burk Planar Graphs
Map coloring
Here’s a map of the counties of Texas:
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Map coloring
Here’s the same map with many colors used:
Dr. James Burk Planar Graphs
Map coloring
The question we have is this:
What is the least number of colors needed to color a map so thatadjacent regions are different colors?
DefinitionA map is n-colorable if it can be colored with n colors, with adjacentregions different colors.
Dr. James Burk Planar Graphs
Map coloring
Let’s represent each map as a graph.Example:
Draw each region of the map as a vertex.
Dr. James Burk Planar Graphs
Map coloring
Draw an edge for each pair of regions that share a border (areadjacent).
Is this map is 3-colorable!
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Map coloring
Is this map is 3-colorable! YES! Is it 2-colorable? NO!
Dr. James Burk Planar Graphs
Map coloring
What can we say about 2-colorable graphs?
TheoremA graph is 2-colorable exactly when there are no circuits with an oddnumber of vertices.
Not 2-colorable Yes, it is 2-colorable
Dr. James Burk Planar Graphs
The Utilities Problem
A question was asked some time ago:
Suppose there are three houses A, B, and C.
And three utilites X, Y, and Z.
Is it possible to connect all three utilities to all three houses withoutany of the connections crossing over each other?
Dr. James Burk Planar Graphs
The Utilities Problem
It’s easy to see how this question can be posed in the realm ofgraphs:
Is it possible to connect each of A, B, and C to each of X, Y, and Zwithout crossing edges?
[This will be an example of a complete bipartite graph.]
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
The Utilities Problem
Dr. James Burk Planar Graphs
The Utilities Problem
Dr. James Burk Planar Graphs
The Utilities Problem
Dr. James Burk Planar Graphs
The Utilities Problem
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
The Utilities Problem
Dr. James Burk Planar Graphs
The Utilities Problem
It doesn’t look like we can do it!
Those graphs in which we can are very special....
Dr. James Burk Planar Graphs
Planarity
DefinitionA graph is said to be planar if it can be drawn so that none if itsedges intersect.
Warning: Just because a graph is drawn with intersecting edges,doesn’t mean that it’s not a planar graph!!
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
Yes! The graph is planar.
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
Dr. James Burk Planar Graphs
Planarity
Example: Is this graph planar?
No, it’s not planar!
Dr. James Burk Planar Graphs
Planarity
Some fun with planar graphs:www.planarity.net
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Planarity
For any graph, how do we know if it’s planar or not?
This is not an easy question to answer.
But, there is a nice property of a graph when it is planar – Euler’sformula.
First, another definition.
Dr. James Burk Planar Graphs
Euler’s Formula
Take any planar graph drawn with no intersecting edges.
The edges divide the plane into different regions called faces.
The region surrounding the graph is called the infinite face.
Examples:
Number of faces = 4 Number of faces = 6
Dr. James Burk Planar Graphs
Euler’s Formula
Theorem (Euler’s Formula)
Take any planar graph drawn with no intersecting edges.
Let v be the number of vertices in the graph.
Let e be the number of edges in the graph.
Let f be the number of faces in the graph.
Then v − e + f = 2.
Dr. James Burk Planar Graphs
Euler’s Formula
Verify Euler’s formula v − e + f = 2 for the following graph:
v = 4 e = 6 f = 4v − e + f = 4− 6 + 4 = 2
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Euler’s Formula
Verify Euler’s formula v − e + f = 2 for the following graph:
v = 6 e = 10 f = 6
v − e + f = 6− 10 + 6 = 2
Dr. James Burk Planar Graphs
Back to Map Coloring
In the 1850’s, several mathematicians asked the following question:
Is it possible to color every map with only 4 colors, so that adjacentregions have different colors?
In other words: Is every planar graph 4-colorable?
This question wasn’t answered until 1976, when two mathematicians(Haken & Appel) proved:
Theorem (The Four-Color Theorem)
Every planar graph is 4-colorable.
Dr. James Burk Planar Graphs
Map coloring
Theorem (The Four-Color Theorem)
Every planar graph is 4-colorable.
And every map can be represented as a planar graph.
So, no matter how complicated the map, four colors will be all that isneeded to color each region with adjacent regions having differentcolors.
Dr. James Burk Planar Graphs
Map coloring
Here’s a map of Texas with four colors used:
Dr. James Burk Planar Graphs
Notes
Notes
Notes
Notes
Homework
1 Is the following graph planar?
2 Is the following graph planar?
3 Draw a complete bipartite graph with 8 vertices. Is it planar?
Dr. James Burk Planar Graphs
Homework
4 Is the graph in the previous problem 2-colorable? 3-colorable?5 Is the graph in problem #1 2-colorable? 3-colorable?
4-colorable?6 Is the graph in problem #2 2-colorable? 3-colorable?
4-colorable?
Dr. James Burk Planar Graphs
More Map Coloring
Dr. James Burk
Course: Math 400: {Graph Theory}
Office: Science Building 106
Email: [email protected]
Fall 2016
Dr. James Burk More Map Coloring
Another application of map coloring – scheduling
Suppose every student club is required to have a float in this year’shomecoming parade.
We have one day to decide what each club’s float will be.
So, each club must meet for an hour to decide on their float.
Problem: some people are in more than one club, so all clubs can’tmeet at the same time.
How many different meeting times do we need so that all clubs canmeet to discuss their parade float?
Dr. James Burk More Map Coloring
Notes
Notes
Notes
Notes
Another application of map coloring – scheduling
In this table, an X means that there is one student in both clubs...
Skiing SGA Debate NHS Paper Service Dem. Rep.Skiing – X XSGA X – X X XDebate X – X X XNHS X X – X X XPaper X X – X XService X X X – X XDem. X X X –Rep. X X X –
Dr. James Burk More Map Coloring
Scheduling
Let’s organize this in a graph:
Dr. James Burk More Map Coloring
Scheduling
Let’s organize this in a graph:
Dr. James Burk More Map Coloring
Scheduling
Let’s organize this in a graph:
An edge between vertices means that these clubs can’t meet at thesame time.
Dr. James Burk More Map Coloring
Notes
Notes
Notes
Notes
Scheduling
Let’s organize this in a graph:
Will 2 meeting times be enough? Is the graph 2-colorable? NO!
Dr. James Burk More Map Coloring
Scheduling
Will 3 meeting times be enough? Is the graph 3-colorable?
I don’t think so!
Dr. James Burk More Map Coloring
Scheduling
Will 4 meeting times be enough? Is the graph 4-colorable?
YES!
Dr. James Burk More Map Coloring
Another application – traffic management
Consider an intersection:
There are 6 lines of traffic: A, B, C, D, E, FSome of the traffic lines can’t move without risk of collision.For example, A and D.How many different cycles of traffic lights will be needed?
Dr. James Burk More Map Coloring
Notes
Notes
Notes
Notes
Another application – traffic management
One vertex for each line of traffic.Dr. James Burk More Map Coloring
Another application – traffic management
One edge for each possibility for collision.
Dr. James Burk More Map Coloring
Another application – traffic management
Are 2 light cycles enough? Is the graph 2-colorable? NO!!
Dr. James Burk More Map Coloring
Another application – traffic management
Are 3 light cycles enough? Is the graph 3-colorable? YES!!
Dr. James Burk More Map Coloring
Notes
Notes
Notes
Notes
Homework
Eight political committees must meet on the same day, but some membersare on more than one committee. So those committees that have members incommon cannot meet at the same time. An “X” in the table below indicatesthat the two corresponding committees share a common member. Usegraph coloring to determine the least number of meeting times that will benecessary so that all members can attend their committee meetings.
A B F J Ed. He FA HoApprop. – X X XBudget – X XFinance X – X X XJudiciary X X – X XEd. – X XHealth X X X –For. Aff. X X X –Housing X X X –
Dr. James Burk More Map Coloring
Notes
Notes
Notes
Notes