Order and size
n = |V|, m = |E|
The order is the vertex count; the size is the edge count.
Private by design: vertex and edge data is parsed and analyzed on this device. It is not uploaded, saved, or included in the page URL.
n = |V|, m = |E|
The order is the vertex count; the size is the edge count.
Σ deg(v) = 2m
Every undirected edge contributes one to the degree of both endpoints.
Σ in(v) = Σ out(v) = m
Every directed edge contributes one incoming and one outgoing incidence.
D = 2m / [n(n − 1)]
The edge count divided by the maximum n(n − 1)/2 for a simple graph.
D = m / [n(n − 1)]
The arc count divided by the maximum number of ordered pairs without loops.
m = n − 1
A connected simple undirected graph is a tree exactly when it has n − 1 edges.
Connected components partition an undirected graph into maximal connected parts. In directed mode, weak components ignore arrow direction, while strongly connected components require a directed path both ways between every pair in a component.
Complete means every permitted pair is joined. Regular means all undirected degrees are equal; directed mode reports degree-balanced regular only when every vertex has the same in-degree and the same out-degree. Bipartite means the vertices can be split into two groups with no edge inside either group; direction is ignored for this test.
A tree is a nonempty connected acyclic undirected graph. A forest is an acyclic undirected graph and may have several components. A directed graph is reported as a DAG when it has no directed cycle.
Euler properties concern using every edge exactly once, not visiting every vertex once. For directed graphs, an Euler circuit requires balanced in- and out-degrees on every edge-bearing vertex; an open Euler trail requires one start vertex with one extra outgoing edge and one end vertex with one extra incoming edge. Edge-bearing vertices must also lie in one weak component.
For V = {A, B, C, D, E} and E = {{A,B}, {B,C}, {C,A}, {C,D}}, the graph has order 5 and size 4. Its degrees are 2, 2, 3, 1, 0, so the sorted degree sequence is (3, 2, 2, 1, 0).
| Check | Result | Reason |
|---|---|---|
| Degree sum | 8 | 2m = 2 × 4 = 8 |
| Density | 40% | 2 × 4 / (5 × 4) = 0.4 |
| Components | 2 | {A,B,C,D} and isolated vertex {E} |
| Cycle | Yes | A–B–C–A is a cycle. |
| Bipartite | No | The three-cycle has odd length. |
Vertex labels are case-sensitive text. Separate the optional vertex list with commas, semicolons, or line breaks. Edge endpoints are automatically added to the graph, but isolated vertices must be listed explicitly. Each edge must occupy one line and contain exactly two labels separated by a comma. Directed input may instead use A -> B; the first endpoint is the source and the second is the destination.
This calculator analyzes finite simple graphs and digraphs. It rejects self-loops. Repeated undirected edges—including reversed repetitions such as A,B and B,A—are collapsed to one edge. Directed reciprocal edges are distinct, while exact repeated arcs are collapsed. Whitespace surrounding labels is ignored, but spaces inside labels are retained.
Connectivity, component, bipartite, and cycle checks use adjacency-list searches. Directed strong components are found with two depth-first passes. Results are limited to 200 vertices, 10,000 unique edges, 20,000 vertex-input characters, and 50,000 edge-input characters so an accidental extreme input does not freeze the page. Density is displayed as 0% when fewer than two vertices exist because no distinct vertex pair is available.
The simple-graph definition, degree-sum theorem, complete-graph edge formula, tree criterion, and undirected Euler conditions follow OpenStax, Contemporary Mathematics, Chapter 12 key concepts and its formula review.
Calculation note: formulas, graph-mode distinctions, validation behavior, and representative outputs checked by the Starlight Tools editorial team. Last reviewed: .
List vertices with commas, semicolons, or line breaks. Then enter one edge per line with a comma between endpoints. For example, A,B joins A and B. In directed mode it means A → B. You may also type A -> B in directed mode.
No. Edge endpoints are added automatically. You only need the vertex list for isolated vertices or when you want to define a graph with no edges.
This tool analyzes simple graphs, so a self-loop such as A,A is rejected. Repeated edges are ignored after the first occurrence. In directed mode, A → B and B → A are different edges.
Undirected degree counts edges touching a vertex. In a directed graph, in-degree counts arrows entering the vertex and out-degree counts arrows leaving it. Their sum is the vertex’s total degree.
Density compares the actual edge count with the largest possible edge count for the same number of vertices. It ranges from 0% for no edges to 100% for a complete simple graph or complete simple digraph.
An undirected graph is connected when every vertex can be reached from every other vertex. A directed graph is weakly connected when this is true after arrow directions are ignored and strongly connected when directed paths exist both ways between every pair.
An Euler trail uses every edge exactly once. A Hamilton path visits every vertex exactly once. This calculator checks degree-based Euler conditions; it does not test for Hamilton paths or cycles.
No. Parsing, graph searches, copying, and CSV creation run locally in your browser. The tool does not transmit or save entered vertices or edges.