Graph vertex degree calculator
Paste an edge list and get each vertex's degree: in the triangle A→B, B→C, C→A every vertex has in-degree 1, out-degree 1 and degree 2, and the degrees add up to 6, twice the 3 edges. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Vertex degree is the first number you compute when you open a graph theory problem set, sketch a dependency digraph, or audit a social network snapshot. This graph vertex degree calculator accepts an edge list, tallies in-degree and out-degree for every vertex that appears, reports total degree as their sum on directed graphs, and checks the classic handshake lemma that the sum of all degrees equals twice the number of edges. Directed mode treats each row as an arc from a source to a target; undirected mode treats each row as a two-way link and counts self-loops with the usual +2 convention.
What degree, in-degree, and out-degree mean on an edge list
In graph theory the degree of a vertex is how many edge ends touch that vertex. On a directed graph—also called a digraph—each edge is an ordered pair from a tail to a head. The out-degree of a vertex is the number of edges that leave it; the in-degree is the number of edges that enter it; the total degree is the sum of in-degree and out-degree.
On an undirected graph each edge is an unordered pair, so a vertex has a single degree equal to the number of incident ends, and textbooks often write that in-degree equals out-degree equals that common degree when the undirected case is embedded in the same notation. Self-loops matter: on a digraph a loop contributes one to in-degree and one to out-degree; on an undirected graph a loop contributes two to the degree because both ends of the loop sit on the same vertex.
Multiedges are allowed: two parallel arcs from A to B both count. Vertices that never appear in the edge list are absent from the output; only vertices that participate in at least one edge are reported.
What you enter, what you get and the handshake check
The optional directed flag defaults to true. When directed is true, each row is a directed arc: out-degree increments at from, in-degree increments at to, and degree is their sum. The handshake lemma—also called the handshaking lemma—states that the sum of all vertex degrees equals twice the number of edges.
For digraphs the same scan also implies that the sum of in-degrees and the sum of out-degrees each equal the edge count; the response surfaces those sums so you can assert all three identities in one call. Empty edge lists are valid and return zero vertices with a true handshake.
Where a graph vertex degree calculator earns its keep
Classrooms and tutoring platforms use a graph vertex degree calculator so learners can check in-degree and out-degree tables for arbitrary homework graphs without miscounting multiedges by hand. Exam generators and LMS auto-graders need a deterministic oracle that marks the handshake lemma true when sum of degrees equals two times the edge count and that rejects malformed edge rows instead of silently inventing vertices.
Software engineers modeling package dependencies, call graphs, or microservice traffic often start with degree distributions: which services have high out-degree fan-out, which sink nodes have high in-degree, and whether a data export accidentally broke the handshaking identity. Network analysts and social-graph notebooks use the same tallies before computing more expensive centrality scores. Failed validation does not consume balance.
Keep edge lists compact, pin the ordered vertices array in tests, and you get reproducible degree tables without standing up a full graph library for a first-pass incidence audit.
What you can do with it
Homework and exam degree tables
Paste a digraph or undirected edge list and verify each vertex in-degree, out-degree, and degree against textbook solutions, including the handshake sum.
LMS and grader oracles
Mark graph-theory items with a deterministic check that sum of degrees equals twice the edges and that rejects empty vertex labels.
Dependency and traffic fan-out audits
Tally service or package in/out degrees from an export edge list before running heavier centrality or cycle detection offline.
FAQ
How do I compute in-degree and out-degree from an edge list?
Send edges as [{from, to}, ...]. With directed true (default), out-degree counts rows where the vertex is from and in-degree counts rows where it is to; degree is their sum.
What is the handshake lemma?
The handshaking lemma says the sum of all vertex degrees equals twice the number of edges.
How are undirected graphs and self-loops counted?
Set directed to false. Each undirected edge adds one to degree at both ends; a self-loop adds two.
Are isolated vertices included?
Isolates never touch the edge list, so they do not affect the handshake sum.
Do parallel edges between the same two vertices count twice?
Yes. Repeated edges are allowed, so each of two arcs from A to B adds one to the out-degree of A and one to the in-degree of B. Nothing is merged or dropped behind your back.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/dev/graph-degree \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"edges":[{"from":"A","to":"B"},{"from":"B","to":"C"},{"from":"C","to":"A"}]}'const res = await fetch("https://api.kit.forhosting.com/dev/graph-degree", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"edges": [
{
"from": "A",
"to": "B"
},
{
"from": "B",
"to": "C"
},
{
"from": "C",
"to": "A"
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/dev/graph-degree",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"edges": [
{
"from": "A",
"to": "B"
},
{
"from": "B",
"to": "C"
},
{
"from": "C",
"to": "A"
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/dev/graph-degree", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"edges":[{"from":"A","to":"B"},{"from":"B","to":"C"},{"from":"C","to":"A"}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"edges":[{"from":"A","to":"B"},{"from":"B","to":"C"},{"from":"C","to":"A"}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/dev/graph-degree", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"edges": [
{
"from": "A",
"to": "B"
},
{
"from": "B",
"to": "C"
},
{
"from": "C",
"to": "A"
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "dev.graph_degree",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Invalid edge rows fail with invalid_input and are not billed.
Input contract, response shape, and the handshake lemma check
Vertex labels may be strings or finite numbers and are normalized to trimmed strings; empty labels and non-object rows fail with invalid_input naming the field. When directed is false, each row is undirected: both endpoints gain one degree (a self-loop gains two), and in-degree and out-degree are set equal to degree so the same response shape works for both modes. On success the body includes directed, edge_count, vertex_count, a vertices array of records with id, in_degree, out_degree, and degree, the aggregates sum_in_degree, sum_out_degree, and sum_degree, handshake_holds, handshake_expected (always two times edge_count), and a short formula string. At most five thousand edges are accepted per request so browser and worker paths stay bounded.
Where a graph vertex degree calculator earns its keep
Content sites that rank for graph vertex degree calculator benefit from a live free browser tool whose pure logic matches the paid API byte-for-byte.
Technical questions
What does the graph vertex degree calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.