0% found this document useful (0 votes)
3 views

LP Formulations

Uploaded by

kaykobad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

LP Formulations

Uploaded by

kaykobad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Several Graph problems and their Linear Program

formulations
Nathann Cohen

To cite this version:


Nathann Cohen. Several Graph problems and their Linear Program formulations. 2019. �inria-
00504914v2�

HAL Id: inria-00504914


https://inria.hal.science/inria-00504914v2
Preprint submitted on 10 Jan 2019

HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est


archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents
entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non,
lished or not. The documents may come from émanant des établissements d’enseignement et de
teaching and research institutions in France or recherche français ou étrangers, des laboratoires
abroad, or from public or private research centers. publics ou privés.
Several Graph Problems and their LP formulation
Nathann Cohen∗

Available since : March 4, 2010


Updated : January 9, 2019

Abstract
This document is meant as an explanation of several graph theoretical functions defined in Sage’s Graph
Library (http://www.sagemath.org/), which use Linear Programming to solve optimization of existence prob-
lems.

Contents
1 Maximum average degree 2

2 Traveling Salesman Problem 3

3 Edge-disjoint spanning trees 4

4 Steiner tree 5

5 Linear arboricity 6

6 Acyclic edge coloring 6

7 H-minor 7


[email protected]
1
1 Maximum average degree

The average degree of a graph G is defined as ad(G) = 2|E(G)| |V (G)| . The maximum average degree of G is
meant to represent its densest part, and is formally defined as :

mad(G) = max ad(H)


H⊆G

Even though such a formulation does not show it, this quantity can be computed in polynomial time
through Linear Programming. Indeed, we can think of this as a simple flow problem defined on a bipartite
graph. Let D be a directed graph whose vertex set we first define as the disjoint union of E(G) and V (G).
We add in D an edge between (e, v) ∈ E(G) × V (G) if and only if v is one of e’s endpoints. Each edge will
then have a flow of 2 (through the addition in D of a source and the necessary edges) to distribute among its
two endpoints. We then write in our linear program the constraint that each vertex can absorb a flow of at
most z (add to D the necessary sink and the edges with capacity z).

Clearly, if H ⊆ G is the densest subgraph in G, its |E(H)| edges will send a flow of 2|E(H)| to
their |V (H)| vertices, such a flow being feasible only if z ≥ 2|E(H)|
|V (H)| . An elementary application of the
max-flow/min-cut theorem, or of Hall’s bipartite matching theorem shows that such a value for z is also
sufficient. This LP can thus let us compute the Maximum Average Degree of the graph.

LP Formulation :

• Mimimize : z

• Such that :
– a vertex can absorb at most z
X
∀v ∈ V (G), xe,v ≤ z
e∈E(G)
e∼v

– each edge sends a flow of 2

∀e = uv ∈ E(G), xe,u + xe,v = 2

• xe,v real positive variable

REMARK : In many if not all the other LP formulations, this Linear Program is used as a constraint.
In those problems, we are always at some point looking for a subgraph H of G such that H does not contain
any cycle. The edges of G are in this case variables, whose value can be equal to 0 or 1 depending on
whether they belong to such a graph H. Based on the observation that the Maximum Average Degree of a
tree on n vertices is exactly its average degree (= 2 − 2/n < 1), and that any cycles in a graph ensures its
2
average degree is larger than 2, we can then set the constraint that z ≤ 2 − |V (G)| . This is a handy way to
write in LP the constraint that “the set of edges belonging to H is acyclic”. For this to work, though, we
need to ensure that the variables corresponding to our edges are binary variables.

corresponding patch :
http://trac.sagemath.org/sage_trac/ticket/7529
2 Traveling Salesman Problem

Given a graph G whose edges are weighted by a function w : E(G) → R, a solution to the T SP is a
hamiltonian (spanning) cycle whose weight (the sum of the weight of its edges) is minimal. It is easy to
define both the objective and the constraint that each vertex must have exactly two neighbors, but this could
produce solutions such that the set of edges define the disjoint union of several cycles. One way to formulate
this linear program is hence to add the constraint that, given an arbitrary vertex v, the set S of edges in the
solution must contain no cycle in G − v, which amounts to checking that the set of edges in S no adjacent
to v is of maximal average degree strictly less than 2, using the remark from section 1.

We will then, in this case, define variables representing the edges included in the solution, along with
variables representing the weight that each of these edges will send to their endpoints.

LP Formulation :

• Mimimize X
w(e)be
e∈E(G)

• Such that :
– Each vertex is of degree 2 X
∀v ∈ V (G), be = 2
e∈E(G)
e∼v

– No cycle disjoint from a special vertex v ∗


∗ Each edge sends a flow of 2 if it is taken

∀e = uv ∈ E(G − v ∗ ), xe,u + xe,v = 2be

∗ Vertices receive strictly less than 2


X 2
∀v ∈ V (G − v ∗ ), xe,v ≤ 2 −
e∈E(G)
|V (G)|
e∼v

• Variables
– xe,v real positive variable (flow sent by the edge)
– be binary (is the edge in the solution ?)

corresponding patch :
http://trac.sagemath.org/sage_trac/ticket/7529
3 Edge-disjoint spanning trees

This problem is polynomial by a result from Edmonds. Obviously, nothing ensures the following formulation
is a polynomial algorithm as it contains many integer variables, but it is still a short practical way to solve it.

This problem amounts to finding, given a graph G and an integer k, edge-disjoint spanning trees T1 , . . . , Tk
which are subgraphs of G. In this case, we will chose to define a spanning tree as an acyclic set of |V (G)|−1
edges.

LP Formulation :

• Maximize : nothing
• Such that :
– An edge belongs to at most one set
X
∀e ∈ E(G), be,k ≤ 1
i∈[1,...,k]

– Each set contains |V (G)| − 1 edges


X
∀i ∈ [1, . . . , k], be,k = |V (G)| − 1
e∈E(G)

– No cycles
∗ In each set, each edge sends a flow of 2 if it is taken

∀i ∈ [1, . . . , k], ∀e = uv ∈ E(G), xe,k,u + xe,k,u = 2be,k

∗ Vertices receive strictly less than 2


X 2
∀i ∈ [1, . . . , k], ∀v ∈ V (G), xe,k,v ≤ 2 −
e∈E(G)
|V (G)|
e∼v

• Variables
– be,k binary (is edge e in set k ?)
– xe,k,u positive real (flow sent by edge e to vertex u in set k)

corresponding patch :
http://trac.sagemath.org/sage_trac/ticket/7476
4 Steiner tree

Finding a spanning tree in a Graph G can be done in linear time, whereas computing a Steiner Tree is NP-
hard. The goal is in this case, given a graph, a weight function w : E(G) → R and a set S of vertices, to
find the tree of minimum cost connecting them all together. Equivalently, we will be looking for an acyclic
subgraph Hof G containing |V (H)| vertices and |E(H)| = |V (H)| − 1 edges, which contains each vertex
from S

LP Formulation :

• Minimize : X
w(e)be
e∈E(G)

• Such that :
– Each vertex from S is in the tree
X
∀v ∈ S, be ≥ 1
e∈E(G)
e∼v

– c is equal to 1 when a vertex v is in the tree

∀v ∈ V (G), ∀e ∈ E(G), e ∼ v, be ≤ cv

– The tree contains |V (H)| vertices and |E(H)| = |V (H)| − 1 edges


X X
cv − be = 1
v∈G e∈E(G)

– No Cycles
∗ Each edge sends a flow of 2 if it is taken

∀e = uv ∈ E(G), xe,u + xe,u = 2be,k

∗ Vertices receive strictly less than 2


X 2
∀v ∈ V (G), xe,v ≤ 2 −
e∈E(G)
|V (G)|
e∼v

• Variables :
– be binary (is e in the tree ?)
– cv binary (does the tree contain v ?)
– xe,v real positive variable (flow sent by the edge)

corresponding patch :
http://trac.sagemath.org/sage_trac/ticket/8403
5 Linear arboricity

The linear arboricity of a graph G is the least number k such that the edges of G can be partitionned into k
classes, each of them being a forest of paths (the disjoints union of paths – trees of maximal degree 2). The
corresponding LP is very similar to the one giving edge-disjoint spanning trees

LP Formulation :

• Maximize : nothing
• Such that :
– An edge belongs to exactly one set
X
∀e ∈ E(G), be,k = 1
i∈[1,...,k]

– Each class has maximal degree 2


X
∀v ∈ V (G), ∀i ∈ [1, . . . , k], be,k ≤ 2
e∈E(G)
e∼v

– No cycles
∗ In each set, each edge sends a flow of 2 if it is taken

∀i ∈ [1, . . . , k], ∀e = uv ∈ E(G), xe,k,u + xe,k,v = 2be,k

∗ Vertices receive strictly less than 2


X 2
∀i ∈ [1, . . . , k], ∀v ∈ V (G), xe,k,v ≤ 2 −
e∈E(G)
|V (G)|
e∼v

• Variables
– be,k binary (is edge e in set k ?)
– xe,k,u positive real (flow sent by edge e to vertex u in set k)

6 Acyclic edge coloring

An edge coloring with k colors is said to be acyclic if it is proper (each color class is a matching – maximal
degree 1), and if the union of the edges of any two color classes is acyclic. The corresponding LP is almost
a copy of the previous one, except that we need to ensure that k2 different classes are acyclic.

corresponding patch :
http://trac.sagemath.org/sage_trac/ticket/8405
7 H-minor

For more information on minor theory, please see


http://en.wikipedia.org/wiki/Minor_%28graph_theory%29
It is a wonderful subject, and I do not want to begin talking about it when I know I couldn’t freely fill pages
with remarks :-)

For our purposes, we will just say that finding a minor H in a graph G, consists in :

1. Associating to each vertex h ∈ H a set Sh of representants in H, different vertices h having disjoints


representative sets
2. Ensuring that each of these sets is connected (can be contracted)
3. If there is an edge between h1 and h2 in H, there must be an edge between the corresponding repre-
sentative sets

Here is how we will address these constraints :

1. Easy
2. For any h, we can find a spanning tree in Sh (an acyclic set of |Sh | − 1 edges)
3. This one is very costly.
To each directed edge g1 g2 (I consider g1 g2 and g2 g1 as different) and every edge h1 h2 is associated a
binary variable which can be equal to one only if g1 represents h1 and g2 represents g2 . We then sum
all these variables to be sure there is at least one edge from one set to the other.
LP Formulation :

• Maximize : nothing
• Such that :
– A vertex g ∈ V (G) can represent at most one vertex h ∈ V (H)
X
∀g ∈ V (G), rsh,g ≤ 1
h∈V (H)

– An edge e can only belong to the tree of h if both its endpoints represent h

∀e = g1 g2 ∈ E(G), te,h ≤ rsh,g1 and te,h ≤ rsh,g2

– In each representative set, the number of vertices is one more than the number of edges in the
corresponding tree X X
∀h, rsh,g − te,h = 1
g∈V (G) e∈E(G)

– No cycles in the union of the spanning trees


∗ Each edge sends a flow of 2 if it is taken
X
∀e = uv ∈ E(G), xe,u + xe,v = 2 te,h
h∈V (H)

∗ Vertices receive strictly less than 2


X 2
∀v ∈ V (G), xe,k,v ≤ 2 −
e∈E(G)
|V (G)|
e∼v

– arc(g1 ,g2 ),(h1 ,h2 ) can only be equal to 1 if g1 g2 is leaving the representative set of h1 to enter the
one of h2 . (note that this constraints has to be written both for g1 , g2 , and then for g2 , g1 )

∀g1 , g2 ∈ V (G), g1 6= g2 , ∀h1 h2 ∈ E(H)

arc(g1 ,g2 ),(h1 ,h2 ) ≤ rsh1 ,g1 and arc(g1 ,g2 ),(h1 ,h2 ) ≤ rsh2 ,g2
– We have the necessary edges between the representative sets

∀h1 h2 ∈ E(H)
X
arc(g1 ,g2 ),(h1 ,h2 ) ≥ 1
∀g1 ,g2 ∈V (G),g1 6=g2

• Variables
– rsh,g binary (does g represent h ? rs = “representative set”)
– te,h binary (does e belong to the spanning tree of the set representing h ?)
– xe,v real positive (flow sent from edge e to vertex v)
– arc(g1 ,g2 ),(h1 ,h2 ) binary (is edge g1 g2 leaving the representative set of h1 to enter the one of h2
?)

corresponding patch : http://trac.sagemath.org/sage_trac/ticket/8404

You might also like