Graph Theory and Adjacency Matrix Calculator

Build an adjacency matrix from an edge list and calculate vertex count, edge count, and degrees for an undirected or directed graph.

Graph TheoryDiscrete MathComputer Science Math

Calculate

Graph type
Edges

Enter one edge per line: source target. Example: A B

Please enter valid values.

What this calculator teaches

Graphs model relationships: vertices are objects and edges are connections. An adjacency matrix records which vertices are connected.

This topic appears in discrete math, algorithms, networks, scheduling, maps, databases, and social-network analysis.

Formula & Symbols

ConceptFormulaMeaning
Adjacency matrixM[i][j]=1 if edge iโ†’j existsFor undirected graphs, the matrix is symmetric.
Degreenumber of incident edgesFor directed graphs, separate indegree and outdegree.
Undirected edge countฮฃ degrees / 2Each edge touches two vertices.

Step-by-Step Examples

Example 1
Small graph
  • Edges are A-B, A-C, B-D, C-D.
  • Vertices are A, B, C, D.
  • A connects to B and C.
โœ“ Degree(A)=2.

Where students use this

๐ŸŽ“
High school and college
Use the tool to check homework and understand each step.
๐Ÿ“Š
Data and modeling
Connect formulas to tables, graphs, and real values.
๐Ÿงช
Science and engineering
Use math results inside physics, chemistry, and engineering problems.
๐Ÿ’ป
Computer science
Apply the same logic to algorithms, systems, and numerical work.

Common Mistakes to Avoid

โš ๏ธ
Forgetting directed order

In a directed graph, A B is different from B A.

โš ๏ธ
Double-counting undirected edges

An undirected edge appears twice in the matrix but counts as one edge.

โš ๏ธ
Missing isolated vertices

An edge list cannot show isolated vertices unless you list them separately.

Frequently Asked Questions

What is a graph in math? โ–พ
A graph is a set of vertices connected by edges.
What is an adjacency matrix? โ–พ
It is a table showing whether each pair of vertices is connected.
What is degree? โ–พ
Degree counts how many edges touch a vertex.
Why use matrices for graphs? โ–พ
Matrices make graph relationships easy to compute with algorithms.

Related Math Calculators

Formula Explorer connections

Interpretation: This relationship represents vectors, linear systems or transformations using matrix structure and vector operations. Assumption: Matrix dimensions must be compatible. Inversion, decomposition and unique solutions require rank, conditioning or nonzero-determinant conditions.

Least-Squares Solution Calculator โ†’Linear Transformation Calculator โ†’LU Decomposition Calculator โ†’Math Formula Explorer โ†’