Graph Theory Calculator: Degrees, Euler, Hamilton, Colouring, Spanning Trees and Planarity
Analyse a graph: degrees, connectivity, Euler and Hamilton cycles, colouring, spanning trees and planarity, with the reasoning shown.
Engineering student calculators
Free textbook calculators with every step shown, so you can check your own working. Pick one, type in your numbers and see the formulas worked out. Or switch to Ask a question for an explained answer. No account needed.
Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.
How this calculator works
Choose a standard graph (complete, cycle, path, star, bipartite, wheel, hypercube, grid or the Petersen graph) and its size, or choose "My own graph" and type up to twelve edges as pairs of vertex numbers. Number the vertices from 1.
The calculator gives the degree of every vertex and checks the handshake lemma (the degrees add to twice the number of edges). It then tests whether the graph is connected and bipartite, whether it has an Euler circuit or trail (a walk using every edge once) and a Hamilton cycle (a closed walk through every vertex once), and finds the chromatic number, the diameter and the number of spanning trees.
The number of spanning trees comes from the matrix tree theorem. Planarity is exact for the standard graphs. For your own graph it is decided when a quick edge-count test settles it, and otherwise it tells you it is not decided. Graphs are limited to 16 vertices.
Formulas used
- \sum_{v}\deg(v) = 2E
- V - E + F = 2
- \tau(G) = \det\left(L\ \text{with one row and column removed}\right)
- \tau(K_n) = n^{n-2}
Worked example
With the default numbers in the calculator above:
- Number of vertices: 5 vertices (Your graph)
- Number of edges: 6 edges
- Degrees of the vertices: 3, 2, 3, 2, 2 (vertex 1 first)
- Handshake check: the degrees add to twice the edges: 12 = 2 x 6, so the count is consistent
- Density: the share of all possible edges that are present: 60.00 % of the possible edges
- Connected pieces: 1 piece: the graph is connected
- Bipartite (can the vertices be split into two groups with every edge between the groups?): No: it contains an odd cycle
- Euler circuit or trail (a walk using every edge exactly once): Euler trail: yes, but not a circuit. Exactly two vertices have odd degree, so a walk uses every edge once if it starts at one and ends at the other
- Hamilton cycle (a closed walk visiting every vertex exactly once): Yes, there is a Hamilton cycle
- Chromatic number (fewest colours so that joined vertices differ): 3 colours
- Diameter (the longest shortest path): 2 edges
- Number of spanning trees: 11 spanning trees
Change the numbers in the calculator to see the full working, every step, for your own case.
A second worked example
A different case, with these numbers: Which graph? Complete graph K(n): every vertex joined to every other; Number of vertices (n). For the hypercube the dimension, for a grid the rows, for K(n,m) the size of the first group 5.
- Number of vertices: 5 vertices (Complete graph K5)
- Number of edges: 10 edges
- Degrees of the vertices: 4, 4, 4, 4, 4 (vertex 1 first)
- Handshake check: the degrees add to twice the edges: 20 = 2 x 10, so the count is consistent
- Density: the share of all possible edges that are present: 100.00 % of the possible edges
- Connected pieces: 1 piece: the graph is connected
- Bipartite (can the vertices be split into two groups with every edge between the groups?): No: it contains an odd cycle
- Euler circuit or trail (a walk using every edge exactly once): Euler circuit: yes. Every degree is even, so a closed walk uses every edge exactly once
- Hamilton cycle (a closed walk visiting every vertex exactly once): Yes, there is a Hamilton cycle
- Chromatic number (fewest colours so that joined vertices differ): 5 colours
- Diameter (the longest shortest path): 1 edge
- Number of spanning trees: 125 spanning trees
Common questions
What is the difference between an Euler path and a Hamilton path?
An Euler path uses every edge exactly once. A Hamilton path visits every vertex exactly once. Euler has a simple test on the degrees; Hamilton has none, so it is searched for.
When does a graph have an Euler circuit?
When it is connected and every vertex has even degree. With exactly two odd-degree vertices there is an Euler trail that starts at one and ends at the other.
What does the chromatic number mean?
It is the fewest colours needed so that no two joined vertices share a colour. Any planar graph needs at most four.
Can it check any graph for planarity?
It is exact for the standard graphs and for small or sparse graphs. For a larger custom graph that passes the edge-count tests it says it cannot decide, and you check for a K5 or K3,3 inside.
Related calculators
Got a question about this? Ask an engineering question and get a plain-language answer with references.
Further reading: Any discrete mathematics text (Rosen, Discrete Mathematics and Its Applications, chapters on graphs and trees); West, Introduction to Graph Theory.
Need a calculator we do not have?
Embed this calculator on your own page
Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.
Need this drawn, designed or checked?
Drafting Central is a mechanical engineering and drafting business working with customers across Australia and around the world. A calculator gives you the numbers; we can turn them into drawings and designs.
Need help with a real project?
Talk to Drafting Central →