Simplify Your Workflow: Search MiniWebtool.
Add Extension
Home Page > Math > Advanced Math Operations > Adjacency Matrix Calculator

Adjacency Matrix Calculator

Convert between adjacency matrix, edge list, and adjacency list. Auto-detects directed/undirected graphs, computes degree sequence, density, connected components, and matrix powers — with an interactive SVG graph visualization.

Adjacency Matrix Calculator
Accepts A-B, A->B, A B, A,B, or matrix rows like 0 1 1 0. Use letters, digits, or underscores for vertex labels.
Comma- or space-separated labels, one per matrix row. Defaults to A, B, C… if omitted.

Embed Adjacency Matrix Calculator Widget

About Adjacency Matrix Calculator

The Adjacency Matrix Calculator is a graph-theory utility that converts between the three canonical graph representations — adjacency matrix, edge list, and adjacency list — and enriches the result with structural analysis: degree sequence, graph density, connected components, and matrix powers. It auto-detects whether your input describes a directed or undirected graph and renders a live SVG visualization alongside every result.

What Is an Adjacency Matrix?

Given a graph G = (V, E) with n vertices, its adjacency matrix is the n × n square matrix A whose entry A[i][j] is 1 if there is an edge from vertex i to vertex j, and 0 otherwise.

A[i][j] = 1 if (vi, vj) ∈ E , else 0

For an undirected graph, the adjacency matrix is always symmetric: every edge {u, v} contributes both A[u][v] = 1 and A[v][u] = 1. For a directed graph (digraph), the matrix may be asymmetric, reflecting the direction of each arc.

Three Representations — Pick What Fits Your Problem

Representation Space Edge lookup List neighbors Best for
Adjacency matrix Θ(n²) O(1) Θ(n) Dense graphs; matrix algebra (powers, eigenvalues)
Adjacency list Θ(n + m) O(deg v) Θ(deg v) Sparse graphs; BFS/DFS and shortest-path algorithms
Edge list Θ(m) Θ(m) Θ(m) Input/output, Kruskal's MST, edge-centric algorithms

Key Metrics Computed

Degree Sequence

For undirected graphs, the degree of a vertex is the number of edges incident to it (with self-loops counting twice). For directed graphs, each vertex has an in-degree (incoming arcs) and out-degree (outgoing arcs). The sorted list of degrees is a classical graph invariant used in isomorphism testing and the Erdős–Gallai realisability theorem.

Handshaking Lemma: Σ deg(v) = 2m (undirected) Σ in-deg(v) = Σ out-deg(v) = m (directed)

Graph Density

Density measures how "full" a graph is relative to the maximum number of edges possible on n vertices.

Undirected: D = 2m / (n(n−1)) Directed: D = m / (n(n−1))

A density of 0 means no edges, 1 means the graph is complete, and values below 0.1 typically indicate a sparse graph where an adjacency list is more space-efficient than a matrix.

Connected Components

A connected component is a maximal subset of vertices such that every pair is joined by a path. For directed graphs, this calculator reports weakly connected components (ignoring arrow directions) — the same subsets you'd get by treating each arc as an undirected edge.

Matrix Powers (A², A³ ... )

A fundamental theorem of algebraic graph theory states that the (i, j) entry of Ak equals the number of walks of exactly length k from vertex i to vertex j. Consequently:

Input Formats Accepted

1. Edge list

One edge per line or comma-separated. Any of these separators work: A-B, A B, A,B, A->B, A--B. Use -> if you want to force a directed interpretation.

A-B, B-C, C-A, C-D (undirected 4-cycle with a tail) A->B, B->C, C->D, D->A (directed cycle of length 4)

2. Adjacency list

One line per vertex, in the form vertex: neighbor1, neighbor2, .... Order doesn't matter; missing vertices are added automatically from the neighbor lists.

A: B, C, D B: A, C C: A, B, D D: A, C

3. Adjacency matrix

One row per line with space- or comma-separated 0/1 values. The matrix must be square. Optionally provide custom labels in the Matrix labels field (otherwise A, B, C… are used).

0 1 1 0 1 0 1 1 1 1 0 1 0 1 1 0

How to Use This Calculator

  1. Pick an input format using the tabbed selector: edge list, adjacency list, or adjacency matrix.
  2. Paste or type your graph in the text area. For matrix input, add optional labels in the Matrix labels field.
  3. Select graph type — leave on Auto-detect and the calculator will infer directedness from arrows (->) or matrix symmetry. Force it to Directed or Undirected if you want to override.
  4. Click Convert & Analyze Graph. The result page shows the adjacency matrix, an interactive SVG rendering, the other two text representations, degree statistics, connected components, and walk-count matrices A² and A³ when the graph is small enough.
  5. Hover a matrix row or a graph node to light up the matching row/column and incident edges — an instant visual proof that each format encodes the same information.

Worked Example

Consider an undirected graph on vertices {A, B, C, D} with edges AB, BC, CA, CD. The adjacency matrix is:

A B C D A [ 0 1 1 0 ] B [ 1 0 1 0 ] C [ 1 1 0 1 ] D [ 0 0 1 0 ]

Key facts the calculator derives:

Common Applications

Frequently Asked Questions

What is an adjacency matrix?

An adjacency matrix is an n × n square matrix used to represent a finite graph. Each cell A[i][j] is 1 if there is an edge from vertex i to vertex j, and 0 otherwise. For undirected graphs the matrix is symmetric, so A[i][j] = A[j][i]. The matrix makes it easy to check whether two vertices are connected in constant time, and matrix powers encode the number of walks between vertices.

How do I tell if a graph is directed from its adjacency matrix?

If the adjacency matrix is symmetric, meaning A[i][j] equals A[j][i] for every pair of indices, the graph is undirected. If there is at least one pair where A[i][j] differs from A[j][i], the graph is directed. This calculator performs that symmetry check automatically when you pick the Auto-detect option.

What does the k-th power of an adjacency matrix represent?

The entry (i, j) of A^k counts the number of walks of exactly length k from vertex i to vertex j. For example, A²[i][j] is the number of 2-step paths, which equals the number of common neighbors between i and j in undirected graphs. This property is used in algorithms for triangle counting, reachability, and PageRank-style computations.

What is graph density?

Graph density is the ratio of the number of edges present to the maximum possible number of edges. For an undirected simple graph with n vertices, density = 2m / (n(n-1)). For a directed graph, density = m / (n(n-1)). A density near 0 means a sparse graph; a density of 1 means a complete graph.

How is an adjacency matrix different from an adjacency list?

An adjacency matrix stores connectivity for every pair of vertices using n² bits, making neighbor lookup O(1) but memory usage O(n²). An adjacency list stores only the actual neighbors of each vertex, giving O(n + m) memory, which is far smaller for sparse graphs, but neighbor lookup requires a linear scan. Matrices are better for dense graphs and matrix-algebra operations; lists are better for sparse graphs and traversal algorithms like BFS/DFS.

Can this tool handle weighted graphs?

The current calculator focuses on unweighted adjacency matrices with 0/1 entries. If you paste a matrix with non-zero numeric weights, every non-zero cell is treated as a 1 for structural analysis. For weighted graph computations such as shortest-path, consider a dedicated weighted-graph tool.

Further Reading

Reference this content, page, or tool as:

"Adjacency Matrix Calculator" at https://MiniWebtool.com/adjacency-matrix-calculator/ from MiniWebtool, https://MiniWebtool.com/

by miniwebtool team. Updated: Apr 20, 2026

You can also try our AI Math Solver GPT to solve your math problems through natural language question and answer.

Related MiniWebtools:

Advanced Math Operations:

Top & Updated:

Random PickerRandom Name PickerLine CounterBatting Average CalculatorRelative Standard Deviation CalculatorFPS ConverterSort NumbersERA CalculatorMAC Address GeneratorRemove SpacesInstagram User ID LookupWord to Phone Number ConverterFacebook User ID LookupMAC Address LookupSum CalculatorFeet and Inches to Cm ConverterOPS CalculatorRandom Quote GeneratorRandom Truth or Dare GeneratorPercent Off CalculatorSHA256 Hash GeneratorBitwise CalculatorSquare Root (√) CalculatorDoubling Time CalculatorJob FinderVertical Jump CalculatorLog Base 10 CalculatorNumber of Digits CalculatorRoman Numerals ConverterSalary Conversion CalculatorAudio SplitterMP3 LooperSlope and Grade CalculatorOn Base Percentage CalculatorSlugging Percentage CalculatorPhone Number ExtractorSaturn Return CalculatorMerge VideosSun, Moon & Rising Sign Calculator 🌞🌙✨Compare Two StringsCaffeine Overdose CalculatorAI Text HumanizerRandom IMEI GeneratorNumber to Word ConverterDecimal to BCD ConverterRandom Poker Hand GeneratorCompound Growth CalculatorClothing Size ConverterFirst n Digits of PiCm to Feet and Inches ConverterBinary to Gray Code ConverterRandom Birthday GeneratorImage ResizerWHIP CalculatorOne Rep Max (1RM) CalculatorGrade CalculatorBCD to Decimal ConverterRandom Fake Address GeneratorRandom Superpower GeneratorOctal CalculatorAdd Prefix and Suffix to TextRandom Activity GeneratorRandom Movie PickerWAR CalculatorVideo to Image ExtractorFile Size ConverterYouTube Channel StatisticsText FormatterTime Duration CalculatorPercent Growth Rate CalculatorRemove AccentInvisible Text GeneratorRandom Writing Prompt GeneratorRandom Object GeneratorOutlier CalculatorQuotient and Remainder CalculatorStair CalculatorCM to Inches ConverterDay of Year CalendarLove Compatibility CalculatorRandom Integer GeneratorWord Ladder GeneratorRemove Leading Trailing SpacesList of Prime NumbersAdd Text to ImageRandom Chess Opening GeneratorGray Code to Binary ConverterImage SplitterAI Punctuation AdderConnect the Dots GeneratorRandom Loadout GeneratorArc Length CalculatorModulo CalculatorImage CompressorNumber ExtractorVideo CropperBingo Card GeneratorRandom Number PickerExponential Decay CalculatorEmail ExtractorURL ExtractorAI ParaphraserSHA512 Hash GeneratorDay of the Year Calculator - What Day of the Year Is It Today?Video CompressorBinary to BCD ConverterIP Address to Hex ConverterSort Lines AlphabeticallyHex to BCD ConverterBCD to Binary ConverterLottery Number GeneratorBCD to Hex ConverterMedian CalculatorStandard Error CalculatorLeap Years ListList RandomizerBreak Line by CharactersAverage CalculatorPVIFA CalculatorReverse VideoHypotenuse CalculatorRemove Audio from VideoActual Cash Value CalculatorScientific Notation to Decimal ConverterAngel Number CalculatorLog Base 2 CalculatorRoot Mean Square CalculatorSum of Positive Integers CalculatorSHA3-256 Hash GeneratorAI Sentence Expander📅 Date CalculatorLbs to Kg ConverterHex to Decimal ConverterRandom Group GeneratorConvolution CalculatorMAC Address AnalyzerRandom String GeneratorAmortization CalculatorMarkup CalculatorPVIF CalculatorName Number CalculatorDecimal to Hex ConverterInstagram Font GeneratorSocial Media Image Size GuideTikTok Money CalculatorTwitter/X Character CounterTwitter/X Timestamp ConverterYouTube Watch Time CalculatorTwitch Earnings CalculatorYouTube Shorts Monetization CalculatorFacebook Ad Cost CalculatorSocial Media ROI CalculatorSocial Media Post Time OptimizerSocial Media Username CheckerCTR CalculatorROAS CalculatorInfluencer ROI CalculatorForce CalculatorAcceleration CalculatorVelocity CalculatorMomentum CalculatorProjectile Motion CalculatorKinetic Energy CalculatorPotential Energy CalculatorWork and Power CalculatorDensity CalculatorPressure CalculatorIdeal Gas Law CalculatorFree Fall CalculatorTorque CalculatorHorsepower CalculatorDilution CalculatorChemical Equation BalancerStoichiometry CalculatorPercent Yield CalculatorEmpirical Formula CalculatorBoiling Point CalculatorTitration CalculatorMole/Gram/Particle ConverterIrregular Polygon Area CalculatorFrustum CalculatorTorus Calculator3D Distance CalculatorGreat Circle Distance CalculatorCircumscribed Circle (Circumcircle) CalculatorInscribed Circle (Incircle) CalculatorAngle Bisector CalculatorTangent Line to Circle CalculatorHeron's Formula CalculatorCoordinate Geometry Distance CalculatorVolume of Revolution CalculatorSurface of Revolution CalculatorParametric Curve GrapherRiemann Sum CalculatorTrapezoidal Rule CalculatorSimpson's Rule CalculatorImproper Integral CalculatorL'Hôpital's Rule CalculatorMaclaurin Series CalculatorPower Series CalculatorSeries Convergence Test CalculatorInfinite Series Sum CalculatorAverage Rate of Change CalculatorInstantaneous Rate of Change CalculatorRelated Rates SolverOptimization Calculator (Calculus)Gradient Calculator (Multivariable)Divergence CalculatorCurl CalculatorLine Integral CalculatorSurface Integral CalculatorJacobian Matrix CalculatorNewton's Method CalculatorRREF Calculator (Row Echelon Form)Matrix Inverse CalculatorMatrix Multiplication CalculatorDot Product CalculatorCross Product CalculatorVector Magnitude CalculatorUnit Vector CalculatorAngle Between Vectors CalculatorNull Space CalculatorColumn Space CalculatorCramer's Rule CalculatorMatrix Diagonalization CalculatorQR Decomposition CalculatorCholesky Decomposition CalculatorMatrix Power CalculatorCharacteristic Polynomial CalculatorBayes' Theorem CalculatorF-Test / F-Distribution CalculatorHypergeometric Distribution CalculatorNegative Binomial Distribution CalculatorGeometric Distribution CalculatorExponential Distribution CalculatorWeibull Distribution CalculatorBeta Distribution CalculatorSpearman Rank Correlation CalculatorFisher's Exact Test CalculatorContingency Table CalculatorOdds Ratio CalculatorRelative Risk CalculatorEffect Size CalculatorPermutations with Repetition CalculatorModular Exponentiation CalculatorPrimitive Root CalculatorPerfect Number CheckerAmicable Number CheckerTwin Prime FinderMersenne Prime CheckerGoldbach Conjecture VerifierMöbius Function CalculatorEgyptian Fraction CalculatorFibonacci Number CheckerDigital Root CalculatorPartition Function CalculatorBoolean Algebra SimplifierKarnaugh Map (K-Map) SolverLogic Gate SimulatorGraph Coloring CalculatorTopological Sort CalculatorAdjacency Matrix CalculatorRecurrence Relation SolverInclusion-Exclusion CalculatorLinear Programming SolverTraveling Salesman Solver (TSP)Hamiltonian Path CheckerPlanar Graph CheckerNetwork Flow Calculator (Max Flow)Stable Marriage Problem SolverFirst-Order ODE SolverSecond-Order ODE SolverDirection Field / Slope Field PlotterEuler's Method CalculatorBernoulli ODE SolverSystem of ODEs SolverGroup Theory Order CalculatorRing and Field CalculatorJordan Normal Form CalculatorMatrix Exponential CalculatorTensor Product CalculatorFast Fourier Transform (FFT) CalculatorZ-Transform CalculatorNumerical Integration CalculatorTOML to JSON ConverterJSON to CSV ConverterXML to JSON ConverterSQL to MongoDB Query ConverterCSS Flexbox PlaygroundCSS Grid GeneratorJWT GeneratorBcrypt Hash Generator / CheckerColor Code Converter (All Formats)Git Command Generator.env File GeneratorLorem Picsum / Placeholder Image GeneratorText to Binary/Hex/ASCII ConverterSyllable CounterSentence CounterParagraph CounterSpeaking Time CalculatorReading Time CalculatorWhitespace VisualizerStrikethrough Text GeneratorTorque Converter (Nm, ft-lb, kgf-cm)Data Transfer Rate ConverterFuel Efficiency ConverterAstronomical Unit ConverterRing Size ConverterPaper Size ReferenceGas Mileage CalculatorEV Range CalculatorEV Charging Time Calculator0–60 / Quarter Mile CalculatorCar Lease CalculatorVehicle Towing Capacity CalculatorExposure Triangle CalculatorCrop Factor CalculatorMegapixel to Print Size CalculatorPhoto File Size EstimatorMusic BPM TapperMusic Key TransposerVideo Bitrate CalculatorSeed Germination Rate CalculatorFertilizer Calculator (NPK)Raised Bed Soil CalculatorFrost Date CalculatorLawn Fertilizer CalculatorCompost Calculator (C:N Ratio)Solar Panel CalculatorSolar ROI CalculatorHome Energy Audit CalculatorAppliance Energy Cost CalculatorWater Usage CalculatorElectricity Generation Cost CalculatorHeat Loss CalculatorFlight Distance CalculatorTravel Budget CalculatorJet Lag CalculatorPacking List GeneratorTip Splitter (Advanced)Lease vs Buy CalculatorHourly Rate Calculator (Freelancer)Invoice Late Fee CalculatorESPP CalculatorStock Split CalculatorOptions Probability CalculatorDollar to Gold ConverterBeam Load CalculatorPipe Flow CalculatorBolt Torque CalculatorSteel Weight CalculatorGravel, Sand & Topsoil CalculatorRandom Sentence GeneratorRandom Paragraph GeneratorRandom Math Problem GeneratorRandom Bible Verse GeneratorRandom Cat/Dog Name GeneratorRandom Debate Topic GeneratorBody Recomposition CalculatorAlcohol Calorie CalculatorMedication Dosage CalculatorPace to Calories CalculatorHydration Calculator