8
Stack Exchange
votes

MIP formulation for graph planarity test

Posted on 5/1/2023
UQ ID:479
Science
Operations Research
Original

In this question, it was asked wether a MIP formulation exists to test for a graph's planarity. The inputs are the graph's nodes and edges, and the output would be a certificate which guarantees that the graph is, or is not, planar.

The python package NetworkX provides a method which does exactly this, but it is not based on linear programming. The source code provides the following references:

  • Ulrik Brandes: The Left-Right Planarity Test (2009)
  • Takao Nishizeki, Md Saidur Rahman: Planar graph drawing, Lecture Notes Series on Computing: Volume 12 (2004)

Some ideas:

  • Euler's theorem (); but this depends on how the nodes (and edges) are organized in space, which is not part of the input data.
  • planar ; but this does not cover all cases, it can be a tool to prove that a graph is not planar, but is useless the otherway around.
  • There is a relationship between planar graphs and book embeddings (see this great video from Numberphile for a recent breakthrough in graph theory on the subject), but not sure it helps.
  • Other characterizations of planar graphs are mentioned on the Wikipedia page, such as Whitney's planarity criterion or Mac Lane's planarity criterion. These might be interesting.

To this day, the question has not been answered. I find the question interesting from a modeling point of view and am curious wheter it can be answered with a MIP.

Keywords & Tags
mixed-integer-programming
modeling
graphs
Model Answers (9)
Submitted answers from various AI models
Unsolved
No reviews yet

K2-Think

Pending UQ Validation
Needs Human Verification
MBZUAI-IFM
Qwen2.5-32B
Sep 18, 2025, 01:50 PM

To determine if a graph is planar using Mixed Integer Programming (MIP), we can model the problem as a feasibility check for the existence of a Kuratowski subdivision (either (K_5) or (K_{3,3})). A graph is non-planar if and only if it contains a subdivision of (K_5) (complete graph on 5 vertices) or (K_{3,3}) (complete bipartite graph on 3+3 vertices). Below is a high-level MIP formulatio...

0 model reviews
0 human reviews
No reviews yet

GPT-5

Failed UQ Validation
Needs Human Verification
OpenAI
Sep 2, 2025, 06:56 AM

Yes. There are several mixed‑integer programming formulations that decide planarity. Two practically useful ways are:

A. As a maximum planar subgraph (MPS) ILP with Kuratowski cuts (branch‑and‑cut)

Idea:

  • Introduce a binary variable x_e for each edge e ∈ E indicating whether e is kept.
  • Maximize the number of kept edges. A graph is planar iff you can keep all edges.

Model:

  • Variables: x_e ∈ ...
0 model reviews
0 human reviews
No reviews yet

Claude Opus 4

Failed UQ Validation
Needs Human Verification
Anthropic
Aug 1, 2025, 12:00 AM

This is indeed a fascinating modeling challenge. While I don't have a complete MIP formulation ready, I can outline some approaches that could potentially lead to one:

Potential MIP Approaches

1. Kuratowski's Theorem Approach

Since a graph is planar if and only if it contains no subdivision of K₅ or K₃,₃, we could formulate:

Variables:

  • Binary variables indicating whether certain s...
0 model reviews
0 human reviews
No reviews yet

o3 Pro

Failed UQ Validation
Needs Human Verification
OpenAI
Aug 1, 2025, 12:00 AM

Yes, you can decide planarity with a Mixed-Integer Programming (MIP) model.
Below are two independent formulations.


  1. “Certificate of planarity’’ : look for a straight–line grid drawing

By Fáry’s theorem every planar graph on n vertices admits a straight-li...

0 model reviews
0 human reviews
No reviews yet

DeepSeek R1

Failed UQ Validation
Needs Human Verification
DeepSeek
deepseek-ai/DeepSeek-R1
Aug 1, 2025, 12:00 AM
<think> We are going to model the planarity testing problem as a MIP. The idea is to use the characterization that a graph is planar if and only if it has a combinatorial embedding that is planar. In particular, we can use the fact that a graph is planar if and only if it admits a planar embedding where the edges are drawn as non-crossing curves.

One common approach is to use the concept of an "...

0 model reviews
0 human reviews
No reviews yet

o4 mini

Failed UQ Validation
Needs Human Verification
OpenAI
Aug 1, 2025, 12:00 AM

Below is one way to turn the existence of a straight‐line planar drawing into a (pure) MILP. It is purely “warm­-up” in the sense that it is neither small nor pretty, but it is completely elementary and of polynomial size in |V|,|E|.


  1. Decision variables

• For each vertex v∈V two integer coordinates
x_v,y_v ∈ {0,1,…,N}, N:=|V|.
• For eac...

0 model reviews
0 human reviews
No reviews yet

o3

Failed UQ Validation
Needs Human Verification
OpenAI
Aug 1, 2025, 12:00 AM

Below is a completely explicit MILP that decides whether an (undirected, simple) graph G=(V ,E ) is planar.
If the model is feasible it returns a combinatorial embedding – an ordering of the incident edges around every vertex – that is a certificate of planarity;
if it is infeasible the graph is non–planar. (The formulation is polynomial in |E| and |V| ; it is therefore only a theoretica...

0 model reviews
0 human reviews
No reviews yet

Gemini 2.5 Pro

Failed UQ Validation
Needs Human Verification
Google
Aug 1, 2025, 12:00 AM

Excellent question that delves into the expressive power of Mixed-Integer Programming. The answer is yes, it is possible to create a MIP formulation to test for graph planarity, but it is a complex modeling exercise and would be vastly less efficient than specialized algorithms.

The key is to move away from the geometric definition (x,y coordinates) which leads to non-linear constraints, and ...

0 model reviews
0 human reviews
No reviews yet

Claude 3.7 Sonnet

Failed UQ Validation
Needs Human Verification
Anthropic
Aug 1, 2025, 12:00 AM

MIP Formulation for Graph Planarity Testing

Testing whether a graph is planar (can be drawn in a plane with no crossing edges) is a fundamental problem in graph theory. While polynomial-time algorithms exist for this purpose, formulating it as a Mixed Integer Program (MIP) presents significant challenges.

Why This Problem Is Difficult

A direct MIP formulation for planarity testing is chall...

0 model reviews
0 human reviews
Submit Your Model's Answer
Your submission will be validated by our LLM validator and then by human experts

You need to be logged in to submit an answer