What is a Graph?
- A graph consists of two sets \(V\) and \(E\) where
- \[V = \{v_1, \ldots, v_n \}\]
- \[E = \{e_1, \ldots, e_m \}\]
- where each edge \(e_i\) consits of an unordered vertex pair \(e_i = \{ v_j, v_k \}\).
- \(j \neq k\) because we avoid self loops.
- For a directed graph we consider edges as ordered pairs.
Example
- Let \(V = \{ 1,2,3, 4,5 \}\) and
- \(E = \{ (1,2), (1,3), (2,3), (2,4) \}\).
- For an unordered graph, the order of the vertices in each edge does not matter.
- \(G = \{V, E\}\) is a graph.
Drawing a graph
Let us draw
Complete Graphs
- A complete graph means that every vertex is connected to every other vertex.
- In other words for all \(i,j\) we have \(e_k = \{v_i, v_j\} \in E\).
- We avoid self loops so \(i \neq j\).
- We denote them by \(K_n\).
Graph Vertex Coloring
- For a graph \(G = \{V,E \}\) a vertex coloring is a choice of colors
- \[ C = \{c_1, \ldots, c_p \}\]
- and an assignment of colors to vertices \(f : V \to C\)
- such that for any edge \(e = \{v_i, v_j \}\),
- \[ f(v_i) \neq f(v_j).\]
- In other words, for each edge we assign its constituent vertices with different colors.
Example
Question: Chromatic Number
- Given a graph \(G = \{ V, E \}\),
- what is the least number of colors to use to vertex color the graph?
- We denote the number by \(\chi(G)\).
- It is called the chromatic number for the graph.
Bounds on Chromatic Number
- Claim: \(\chi(G) \leq n\) where n is number of vertices of G.
- Proof:
- For complete graphs equality holds, \(\chi(G) =n\).
- Can we find a better bound?
contd..
- Let us look at the degrees at each vertex.
- Here degree of a vertex is the number of edges emanating from the vertex.
- Example:
contd..
- Suppose \(\Delta(G)\) is the largest degree of any vertex.
- \[ \chi(G) \leq \Delta(G) +1 .\]
- Can we show this?
- Answer: Use a greedy algorithm.
Application: Class Scheduling
- If there are \(n\) classes.
- Students signup for them without knowing the time schedules.
- How many distinct time slots to pick?
- Answer:
Answer:
- Pick vertices as each class.
- Join two vertices by an edge if there is a student taking both classes.
- Chromatic number gives the minimum number of distinct time slots.
LP Formulation
- Can you formulate an LP for the above problem?
- Say we have a graph \(G = (V,E)\).
- To start off we can pick \(n\) colors \(\{ c_1, \ldots, c_n \}\).
- Variables:
- \(y[i] = 1\) if we use color \(i\) and 0 otherwise.
- \(x[i,j] = 1\) if vertex \(i\) is assigned color \(j\), 0 otherwise
Chromatic LP
- Minimize $_{i} y[i] $.
- subject to
- \(\sum_k x[ik] = 1\) for every \(i\).
- \(x[ik] \leq y[k]\)
- \(x[ik] + x[jk] \leq 1\) for \((v_i, v_k) \in E\) and each \(k\).
- \(y[k] \leq y[k-1]\).
- \(x[ik], y[k] \in \{0,1 \}\).
Edge Coloring
- Question: How many colors do we need to color the edges of a graph such that no two edges of the same color connect at a vertex?
- Example:
Bounds on Edge Coloring
- We need at least \(\Delta(G)\) colors.
- Infact this is a very good estimate.
- Vizing in 1964 proved that the number of colors needed is either
- \(\Delta(G)\) or
- $(G) +1 $.
Edge Coloring Example
- Schedule matches in a tournament.
- Suppose we have 9 teams and we have a graph saying which teams must play each other.
- How many rounds of play needed to achieve this?
Example:
LP Formulation
- It is similar to vertex LP except this time we do for edges.