
- Graph Theory - Home
- Graph Theory - Introduction
- Graph Theory - History
- Graph Theory - Fundamentals
- Graph Theory - Applications
- Types of Graphs
- Graph Theory - Types of Graphs
- Graph Theory - Simple Graphs
- Graph Theory - Multi-graphs
- Graph Theory - Directed Graphs
- Graph Theory - Weighted Graphs
- Graph Theory - Bipartite Graphs
- Graph Theory - Complete Graphs
- Graph Theory - Subgraphs
- Graph Theory - Trees
- Graph Theory - Forests
- Graph Theory - Planar Graphs
- Graph Theory - Hypergraphs
- Graph Theory - Infinite Graphs
- Graph Theory - Random Graphs
- Graph Representation
- Graph Theory - Graph Representation
- Graph Theory - Adjacency Matrix
- Graph Theory - Adjacency List
- Graph Theory - Incidence Matrix
- Graph Theory - Edge List
- Graph Theory - Compact Representation
- Graph Theory - Incidence Structure
- Graph Theory - Matrix-Tree Theorem
- Graph Properties
- Graph Theory - Basic Properties
- Graph Theory - Coverings
- Graph Theory - Matchings
- Graph Theory - Independent Sets
- Graph Theory - Traversability
- Graph Theory Connectivity
- Graph Theory - Connectivity
- Graph Theory - Vertex Connectivity
- Graph Theory - Edge Connectivity
- Graph Theory - k-Connected Graphs
- Graph Theory - 2-Vertex-Connected Graphs
- Graph Theory - 2-Edge-Connected Graphs
- Graph Theory - Strongly Connected Graphs
- Graph Theory - Weakly Connected Graphs
- Graph Theory - Connectivity in Planar Graphs
- Graph Theory - Connectivity in Dynamic Graphs
- Special Graphs
- Graph Theory - Regular Graphs
- Graph Theory - Complete Bipartite Graphs
- Graph Theory - Chordal Graphs
- Graph Theory - Line Graphs
- Graph Theory - Complement Graphs
- Graph Theory - Graph Products
- Graph Theory - Petersen Graph
- Graph Theory - Cayley Graphs
- Graph Theory - De Bruijn Graphs
- Graph Algorithms
- Graph Theory - Graph Algorithms
- Graph Theory - Breadth-First Search
- Graph Theory - Depth-First Search (DFS)
- Graph Theory - Dijkstra's Algorithm
- Graph Theory - Bellman-Ford Algorithm
- Graph Theory - Floyd-Warshall Algorithm
- Graph Theory - Johnson's Algorithm
- Graph Theory - A* Search Algorithm
- Graph Theory - Kruskal's Algorithm
- Graph Theory - Prim's Algorithm
- Graph Theory - Borůvka's Algorithm
- Graph Theory - Ford-Fulkerson Algorithm
- Graph Theory - Edmonds-Karp Algorithm
- Graph Theory - Push-Relabel Algorithm
- Graph Theory - Dinic's Algorithm
- Graph Theory - Hopcroft-Karp Algorithm
- Graph Theory - Tarjan's Algorithm
- Graph Theory - Kosaraju's Algorithm
- Graph Theory - Karger's Algorithm
- Graph Coloring
- Graph Theory - Coloring
- Graph Theory - Edge Coloring
- Graph Theory - Total Coloring
- Graph Theory - Greedy Coloring
- Graph Theory - Four Color Theorem
- Graph Theory - Coloring Bipartite Graphs
- Graph Theory - List Coloring
- Advanced Topics of Graph Theory
- Graph Theory - Chromatic Number
- Graph Theory - Chromatic Polynomial
- Graph Theory - Graph Labeling
- Graph Theory - Planarity & Kuratowski's Theorem
- Graph Theory - Planarity Testing Algorithms
- Graph Theory - Graph Embedding
- Graph Theory - Graph Minors
- Graph Theory - Isomorphism
- Spectral Graph Theory
- Graph Theory - Graph Laplacians
- Graph Theory - Cheeger's Inequality
- Graph Theory - Graph Clustering
- Graph Theory - Graph Partitioning
- Graph Theory - Tree Decomposition
- Graph Theory - Treewidth
- Graph Theory - Branchwidth
- Graph Theory - Graph Drawings
- Graph Theory - Force-Directed Methods
- Graph Theory - Layered Graph Drawing
- Graph Theory - Orthogonal Graph Drawing
- Graph Theory - Examples
- Computational Complexity of Graph
- Graph Theory - Time Complexity
- Graph Theory - Space Complexity
- Graph Theory - NP-Complete Problems
- Graph Theory - Approximation Algorithms
- Graph Theory - Parallel & Distributed Algorithms
- Graph Theory - Algorithm Optimization
- Graphs in Computer Science
- Graph Theory - Data Structures for Graphs
- Graph Theory - Graph Implementations
- Graph Theory - Graph Databases
- Graph Theory - Query Languages
- Graph Algorithms in Machine Learning
- Graph Neural Networks
- Graph Theory - Link Prediction
- Graph-Based Clustering
- Graph Theory - PageRank Algorithm
- Graph Theory - HITS Algorithm
- Graph Theory - Social Network Analysis
- Graph Theory - Centrality Measures
- Graph Theory - Community Detection
- Graph Theory - Influence Maximization
- Graph Theory - Graph Compression
- Graph Theory Real-World Applications
- Graph Theory - Network Routing
- Graph Theory - Traffic Flow
- Graph Theory - Web Crawling Data Structures
- Graph Theory - Computer Vision
- Graph Theory - Recommendation Systems
- Graph Theory - Biological Networks
- Graph Theory - Social Networks
- Graph Theory - Smart Grids
- Graph Theory - Telecommunications
- Graph Theory - Knowledge Graphs
- Graph Theory - Game Theory
- Graph Theory - Urban Planning
- Graph Theory Useful Resources
- Graph Theory - Quick Guide
- Graph Theory - Useful Resources
- Graph Theory - Discussion
Graph Theory - Planarity Testing Algorithms
Planarity Testing in Graph Theory
Planarity testing is the process of determining whether a given graph can be drawn on a plane without any edges crossing. A graph is considered planar if it can be drawn such that no two edges intersect except at their endpoints. If a graph cannot be drawn in this way, it is non-planar.
Planarity testing plays an important role in fields such as circuit design, map coloring, and network topology, where avoiding edge crossings is essential for maintaining clarity. In this tutorial, we will explore various algorithms used for testing graph planarity.
Algorithms for Planarity Testing
There are several algorithms used to test the planarity of a graph. The most popular used planarity testing algorithms are −
- Kurathowski's Theorem-Based Algorithms: These algorithms determine planarity by checking if the graph contains a subgraph that is a subdivision of either K5 (the complete graph on 5 vertices) or K3,3 (the complete bipartite graph on 6 vertices).
- Hopcroft and Tarjan Algorithm: This algorithm is highly efficient for planarity testing, using depth-first search (DFS) to test planarity in linear time.
- Boykov-Kolmogorov Algorithm: This algorithm uses a max-flow min-cut approach for planarity testing and is particularly useful in certain conditions to check graph planarity.
The Hopcroft and Tarjan's Algorithm
The Hopcroft and Tarjan planarity testing algorithm operates in O(n) time, where n is the number of vertices. This algorithm is based on the concept of embedding the graph in a plane, which involves drawing the graph while maintaining its structure and ensuring that no edges cross each other.
The major steps involved in the algorithm are as follows:
- Step 1: The algorithm performs a depth-first search (DFS) traversal of the graph, marking the discovery time and low points of each vertex.
- Step 2: During the DFS traversal, the algorithm attempts to "embed" the graph into a planar representation by exploring the vertices and edges while maintaining the DFS properties.
- Step 3: If the graph cannot be embedded without edge crossings, it is concluded to be non-planar. Otherwise, the graph is planar.
Example of Hopcroft and Tarjan Algorithm
Let us consider a graph with 5 vertices and 8 edges. The Hopcroft and Tarjan algorithm will attempt to traverse the graph using DFS, checking whether it can be embedded in the plane without crossing edges. If the embedding is successful, the graph is planar; otherwise, the algorithm will detect a non-planar structure.

The above graph contains back edges, indicating it is non-planar.
The Boykov-Kolmogorov Algorithm
The Boykov-Kolmogorov algorithm uses the max-flow min-cut method and is particularly useful for planarity testing in combinatorial optimization problems.
The max-flow min-cut theorem states that in a flow network, the maximum amount of flow that can be sent from a source to a sink is equal to the total weight of the smallest cut that separates the source and sink.
Although the Hopcroft and Tarjan algorithm is more commonly used for general graph planarity testing, the Boykov-Kolmogorov approach is suitable for specific cases where maximum flow problems are involved.
The major idea is to treat the graph as a flow network and apply the max-flow min-cut theorem to determine if a planar embedding is possible. One of the major advantages of this algorithm is its efficiency in handling dense graphs and large-scale network problems.
Using Kuratowski's Theorem
As mentioned earlier, Kuratowski's Theorem states that a graph is planar if and only if it does not contain a subgraph that is a subdivision of K5 or K3,3.
While this theorem provides a solid theoretical foundation for planarity testing, it is less efficient than algorithms like Hopcroft and Tarjan's, as identifying these subgraphs can be computationally expensive.
Nevertheless, there are algorithms based on this theorem that can detect non-planarity by identifying these subgraphs. The general steps involved are −
- Step 1: Search the graph for any subgraphs that resemble K5 or K3,3.
- Step 2: If such a subgraph is found, the graph is declared non-planar.
- Step 3: If no such subgraph is found, the graph is potentially planar, but additional checks may be needed.
Applications of Planarity Testing Algorithms
Planarity testing algorithms are used in several areas of research and practical fields, such as −
- Circuit Design: Planar graphs are used to design integrated circuits where wires must be laid out without crossing.
- Graph Drawing: In graphical user interface (GUI) applications and visualization tools, planarity testing helps draw graphs in a way that minimizes edge crossings.
- Geographical Mapping: Planarity testing is useful for representing maps and regions in a way that avoids overlapping edges between borders or regions.
Complexity of Planarity Testing Algorithms
The complexity of planarity testing algorithms is an important factor when choosing the most suitable method for a particular application −
- Hopcroft and Tarjan Algorithm: This algorithm operates in linear time, O(n), where n is the number of vertices. This makes it suitable for large graphs.
- Boykov-Kolmogorov Algorithm: The max-flow approach generally has higher computational complexity, especially for dense graphs. However, it is effective for specific scenarios involving network flow problems.
- Kuratowski's Theorem-Based Approach: Algorithms based on this theorem can be computationally expensive, as they involve checking for subgraphs. The complexity depends on the size of the graph and the search technique used for identifying subgraphs.
Challenges in Planarity Testing
Although there are useful algorithms for planarity testing, it still presents several challenges −
- Graph Size: The performance of planarity testing algorithms can degrade for large graphs, especially when using methods based on Kuratowski's Theorem.
- Edge Density: Dense graphs with many edges may require more advanced techniques or approximations to test for planarity effectively.
- Practical Limitations: Planarity testing algorithms are often designed for specific problem domains, and their efficiency can vary based on the graph type and application.