Chapter 7 Graph Discrete Structures Notes

Table of Contents

P and NP Problems Some Other Hamiltonian Theorems GANNT Critial Path Charts and PERT diagrams General Discussion of Graphs and Trees
Markov Transition Matrix Leonev Input Output Modeling The University Network Diagram (a real life example of using graphs in network design.) Another view of network backbone.
View of ATM OC3 Rules for Planar Graphs Coloring Rules A example of an inductive Proof
An Example of a Journal Article on Shortest Path from the Journal of Algorithms(PDF)

You may want to look at these to see what kind of work is being done in this area.

An example of a Journal Article on Hamiltonian from the Journal of Algorithms (PDF).

You may want to look at these to see what kind of work is being done in this area.

   

 

Markov Transition Matrix
  A B C D
A .7 0 .3 0
B .5 0 .5 0
C 0 .4 0 .6
D 0 .2 0 .8

 

markov.gif (6222 bytes)

The probability that a person using product A stays with product A is .7; going to product C is .2. Similiarly, a person using product B has a .5 chance of switching to product A, and a .5 chance of going to product B. A person using C has a .4 probability of going to B, .6 of going to D. A person using D has a .2 probability of going to B and .8 of staying with D. This is the first round. One of the properties is the sum of the rows is 1.

On the second round, after the switches are made, we use the same matrix to determine where they will go next. The same hold for each round. At some point, we may reach a steady state and this will represent the final market share of the product.

To get to the nth round using transition matrix T, we need only find Tn. The find the final state, we ne to find Tn as n goes to infinity. In practice, this is very easy to do. Thus, starting with a matrix that tells us preferences between products (or anything else) we can determine the final staedy-state outcome. This is useful in such areas as marketing and social behavioral modeling, but also in queuing theory.

Some Other Hamiltonian Theorems These define sufficient conditions. This means that if a graph has this property, then it is Hamiltonian. However, these are not necessary conditions. A graph may be Hamiltonian but not have these properties. In addition, the checking all the conditions is itself time consuming.

Below is a comparison of P and NP problems (see section 2.2, p. 110). I included a few additional definitions that are in common use. Basically, a P problem can be solved in polynomial time. That is, as more vertices are added, the time it takes goes up at the rate of v raised to some power. On the otherhand, for NP problems, the rate of increase goes up as the power of the sum of vertices. For example, if the are 4 vertices, then the time to search is 2**4, if there are 20, it is 2**20. In the polynomial case, we would have 4**2 and 20**2. (2**2=400, 2**20=1048576). NP problems, as we will see, arise from the fact that as we add another vertex, we have to compare it to all the others in the graph. In P problems, we just have to deal with the edges that are added on (this is a bit simplistic, but it gives you the flavor). Again, I delayed the discussion of this topic til we got to graphs and trees since this is the area that is is often used.These are important concepts in Computer Science; the best way to understand them is to be familiar with a few examples.

P(polynomial) NP (non-deterministic polynomial) NP-complete NP-hard
Can be solved in polynomial time

ie. O(nb)

n may be, for example, the number of vertices.

Solution requires greater than polynomial time.

i.e. O(bn)

O(nb) < O(bn)

If any of this class of problems can be solve in polynomial time, then they all can. None, to date can be. a problem is NP-hard if every problem in NP can be transformed into it polynomial. An NPhard problem cannot be easier than any problem in NP
  Answers can be verified in polynomial time. An  NP problem that is NP-hard in NP-complete.. NP complete problems are the intersection of NP and NP-hard problems.  
Examples: Shortest Path Problem, Euler circuits Examples: Traveling Salesman Problem, Hamiltoniam circuits.    

This chapter, along with the chapters on Trees and Modeling Computation, will give you the ability to transform a real world problem into a diagram and then into a computer algorithm. The chapter on Trees, especially, will give you some background material for Data Structures. If you get a fair understanding of the terminology used with graphs and trees, you will find Data Structures to be a much easier course. The few items of Modeling Computation that we will be covering will give you a working knowledge about such items as the structure of computer languages and Automata.  You will gain some experience in think through problems and formulating models of solutions. Once you have a good math model of the problem that you want to solve, you can then use specific algorithms to solve the problem. In this course we are dealing with the first part -- getting the model. In courses such as Data Structures, you will be writing programs that solve problems such as scanning a graph or a tree. In courses such as Linear Programming / Operations Research, you will be solving such problems as the Minimum Spanning Tree, Traveling Salesman Problem, flow models, assignment and transportation problems as well as many others.

This part of the course should be fun. In what other class do you get to doodle. But out of these doodles comes some really fun concepts. In some ways the more you look at the diagrams, the more you see. This branch of math is also know as recreational math.    

There are many examples of the use of graphs in modeling real-world situations that are used in CS. A number of them are mentioned in the text over the next few chapters. Some others include network flow models, transportation and assignment models, input-output models, Markov models (in which the path length corresponds to the probability of getting from one point to the next. If you want to look at the probability of going from point a to b and the b to c, you multiply the matrix just as you would the Boolean matrix. Only this time you get the probability of getting from a to c. This is frequently used to model repeated behaviors.   The probabilities could also be circuit reliability. The idea of "graph coloring" gives rise to models that deal with scheduling conflicts. The ways graphs are used is almost endless. Below are two examples for the output of a computer program that models scheduling give the activities, order and duration. 

These charts show the start and end time of different activities and also show which activities can be done at the same time and which need to be finished before others can start. These graphs include the run time (along with slack times/wait times/float times) of projects along with the order the tasks must be completed. (This was run using SAS project manager. There are other programs that produce similar results.)

The first diagram show the scheduling of computer tasks. CR means that this is a critical task. The various activities are listed on the left side. The graph also lists slack time. This is the amount of wait time after the job is done before the next one can begin because some other job needs to finish.  The activities that have to be done at a certain time are also marked. The relationships of the projects are show. (This comes from the GANTT procedure in SAS. Other displays include a calendar version and a table version. The program also allows you to play with the criteria.)

 

gantt.jpg (28724 bytes)

This is another example.

gantt2.jpg (27847 bytes)

 

Some Other Hamiltonian Theorems (See Balakrishnan, Introductory Discrete Mathematics, pp149-153)
Every tournament has a directed Hamiltonian path. If there are no cycles of length 3, then the path is unique.
A strongly connected digraph with n vertices is a Hamiltonian digraph if deg u + deg v is at least 2n-1 for every pair of vertices u and v such that there is no arc from u to v and from v to u. A digraph with n vertices is Hamiltonian if out deg u + in degree v is at least n for every pair of vertices u an v such that there is no arc from u to v. A strongly connected digraph with n vertices is Hamiltonian if outdegree v + indegree v is at least n for every vertex v. A digraph with v vertices is Hamiltonian if both the outdegree and the indegree of each vertex is at least n/2.
If deg u + deg v is at least 2n-3 for every pair of vertices u and v such that there is no arc from one to the other in the digraph, the the digraph has a Hamiltonian path. If outdegree u +indegree v is at least (n-1) for every pair of vertices such that there is no arc from u to v in a digraph, then the digraph has a directed Hamiltonian path If outdegree v + indegree v is at least (n-1) for every vertex v in the digraph with n vertices, the digraph has a directed Hamiltonian path. If both the outegree and indegree of each vertex is at least (n-1)/2 in a digraph, the the digraph has a directed Hamiltonian path.
If a simple graph with n vertices (n>=3) such that for all distinct nonadjacent vertices i and j, the degree of i + degree of j exceeds n, then the graph is Hamiltonian-connected.

Below is a Leonev Input Output Model which shows the flow of students from one semester to the next. This model shows outflows and inflows. From this I was able to proiduce a program that showed where the gain and loss if students was from the fall to the Spring semester. Drawing a digram like this is very helpful since it allows one to look at all the possiblities. In addition, if the lines have probabilities attached, you can the develop a Markov Transition Matrix which allows you to do future and steady state projections.

 

leonev.gif (13795 bytes)

 

If G is a planar graph

A G is planar when
r=e-v+2    r=regions, e=edges, v=vertices It is a subgraph of a planar graph.
3/2r <= e <= 3v - 6   v >= 3
a maximal planar graph is a planar graph with the maximum number of edges possible.
  1. The following are the same:
    e=3v-6
  2. region is triangular (has 3 sides) including the unbounded region
  3. G is maxamal planar
 
e <= 2v -4 if there are no circuits of length 3 (i.e. no triangles) and v >= 3. A maximal planar graph (in this case when e=2v-4) with no circuits of length 3 is Hamiltonian.  
min degree of all the vertices <= 5  

A graph is non planar when

It has a subgraph that contains K3,3 or K5. K5. contradicts the rule e <= 3v-6 K3,3 contridicts the rule e <= 2v-4
It is a supergraph of a non-planar graph.

 

Coloring Rules (some of these notes are from Saaty, The Four Color Problem)

Coloring can be thought of as partitioning vertices in a graph so that no two adjacent vertices are in the same set.

type colors reasoning
Kn n Each vertex conects to every other vertex so no two vertices can be colored with the same color.
Km,n 2 A bipartate graph, by definition, is a graph between all the vertices of one set with all those of a second set; hence, there are only two sets or two colors.
Cn, n even 2 Alternating vertices take a different color.
Cn, n is odd 3 Alternating vertices take a different color, but the last odd vertex needs an additional color.
in general less than or equal to the vertex with the max degree. We have to color this vertex with one color and all its adjacent vertices with another color. This is an upper bound or worst case situation.
cubic map bounded by an even number of sides 3 A cubic map is a graph with each vertex of degree 3.
planar 4 The proof for this was established in 1976. It takes up a book. Many of the false starts resulted in the various theorems in this chart.
A triangular map (every region has 3 sides) which does not contain K4. 3 This is an extension of the cubic map theorem.
planar graph with no cycles of length 3 3  
A graph with no odd-length cyles 2 Any two colored graph can not contain a cycle.
A graph with every vertex with an even degree>=2 2 Think of a checkerboard.

 

A example of an inductive Proof

Show that r=e-v-2
Start by showing that this holds when e=1. When e=1, there are 2 regions and two vertices, so we have 2=1-2+1 +2 from the formula.
Case 1: Add a vertex that conexts TWO vertices Case 2: Add a vertex that conexts ONLY ONE vertices
We now form two regions out of one, so we have r(n+1)=r(n)+1; we also so have a new edge, so e(n+1)=e(n)+1, but we still have the same number of vertices v(n+1)=v(n).

Putting this in the formula
r(n)=e(n)-v(n)+2, we get

r(n+1)-1=e(n+1)-1 -v(n+1)+2, or

r(n+1)=e(n+1)-v(n+1)+2

We have should that if the statement is true for n, it is also true for n+1.

 

We have now added an edge and a vertex, but no new regions. So, e(n+1)=e(n)+1, v(n+1)=v(n)+1 and r(n+1)=r(n).


Putting this in the formula
r(n)=e(n)-v(n)+2, we get

r(n+1)=e(n+1)-1-v(n+1)+1+2 or

r(n+1)=e(n+1)-v(n+1)+2

We have should that if the statement is true for n, it is also true for n+1.

To prove something inductively, we start by showing that it is true when n=1.
Next we show that it is true for all n+1.
Section 3.2 gives more details; however, of all the problems in the book thus far, I found that this was the easiest example to for me to understand.

You are the visitor to this site.

Return to Main Page