Visualize and analyze graphs with our interactive graph theory tool. Calculate shortest paths, minimum spanning trees, and more.
Apply algorithms to analyze your graph
View different representations of your graph
| Node |
|---|
Graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between objects.
Key Concepts: Graphs consist of vertices (nodes) connected by edges. Graphs can be directed or undirected, weighted or unweighted.
Complete Graph (Kn):
Every pair of distinct vertices is connected by a unique edge
K3: Triangle with 3 vertices and 3 edges
K4: Tetrahedron with 4 vertices and 6 edges
Cycle Graph (Cn):
Vertices connected in a closed chain
C3: Triangle
C4: Square
C5: Pentagon
Tree:
Connected acyclic graph
Properties: n vertices, n-1 edges
Examples: Binary tree, star graph
Bipartite Graph:
Vertices divided into two disjoint sets
All edges connect vertices from different sets
Examples: Complete bipartite K3,3
Visits all vertices level by level
Applications: Shortest path in unweighted graphs
Time complexity: O(V + E)
Explores as far as possible along each branch
Applications: Cycle detection, topological sorting
Time complexity: O(V + E)
Finds shortest paths from a source vertex
Works for weighted graphs with non-negative weights
Time complexity: O(V²) or O(E + V log V) with heap
Finds minimum spanning tree for weighted graphs
Greedy algorithm that grows the tree one vertex at a time
Time complexity: O(V²) or O(E log V) with heap
A graph is a collection of vertices (nodes) connected by edges (links). It can have cycles and be disconnected.
A tree is a special type of graph that:
All trees are graphs, but not all graphs are trees.
There are two common ways to represent graphs:
This calculator supports both representations.
Breadth-First Search (BFS) and Depth-First Search (DFS) are two fundamental graph traversal algorithms:
| Feature | BFS | DFS |
|---|---|---|
| Approach | Level by level | Branch by branch |
| Data Structure | Queue | Stack |
| Memory Usage | More memory (stores all nodes at current level) | Less memory (only stores path from root) |
| Applications | Shortest path in unweighted graphs, peer-to-peer networks | Topological sorting, cycle detection, path finding |
| Time Complexity | O(V+E) | O(V+E) |
Dijkstra's algorithm is used to find the shortest path between nodes in a graph with non-negative edge weights.
Key characteristics:
Applications:
A bipartite graph is a graph whose vertices can be divided into two disjoint sets U and V such that:
Properties:
Applications:
Detecting cycles in a graph can be done using several methods:
This calculator automatically detects cycles when analyzing graphs.
The Four Color Theorem states that:
Any planar graph can be colored with at most four colors such that no two adjacent vertices share the same color.
Key points:
This calculator computes the chromatic number of graphs, which for planar graphs will be ≤4.
Graph theory has numerous real-world applications: