Background image of landing

Unrivalled
Education
Solutions for your
Family

How is a graph represented using an adjacency matrix?

A graph can be represented using an adjacency matrix, which is a square matrix where each cell indicates the presence or absence of an edge between vertices.

More specifically, an adjacency matrix is a square array used to represent a finite graph. The elements of this matrix indicate whether pairs of vertices are adjacent. The rows and columns of the matrix are labeled with the graph’s vertices, and the cell located at the intersection of row vv and column ww is filled based on whether there is an edge connecting vertices vv and ww.

In the case of an undirected graph, the adjacency matrix is symmetric. This symmetry arises from the fact that if there is an edge from vertex vv to vertex ww, there must also be an edge from vertex ww to vertex vv. Consequently, the entries of the matrix are either 00 or 11, with 11 indicating the presence of an edge and 00 indicating its absence.

For directed graphs (or digraphs), the adjacency matrix does not have to be symmetric, as the edges have a specific direction. In this scenario, the entry in row vv and column ww signifies an edge that goes from vertex vv to vertex ww.

When dealing with weighted graphs, the entries of the adjacency matrix can represent the weight of each edge instead of merely indicating whether an edge exists. For instance, if the weight of the edge from vertex vv to vertex ww is 22, then the cell at the intersection of row vv and column ww would contain the value 22.

The adjacency matrix is a valuable tool for quickly checking if an edge exists between two vertices. However, it is not the most space-efficient representation for sparse graphs, where the number of edges is significantly less than the square of the number of vertices. In such cases, alternative representations like an adjacency list or edge list may be more efficient.

Answered by: Dr. Olivia Green
A-Level Computer Science Tutor
Medal Icon

100%

Globe Icon

Global

Crest Icon

97%

Professional Tutors

International Tuition

Independent School Entrance Success

All of our elite tutors are full-time professionals, with at least five years of tuition experience and over 5000 accrued teaching hours in their subject.

Based in Cambridge, with operations spanning the globe, we can provide our services to support your family anywhere.

Our families consistently gain offers from at least one of their target schools, including Eton, Harrow, Wellington and Wycombe Abbey.

Medal Icon

100%

Professional Tutors

All of our elite tutors are full-time professionals, with at least five years of tuition experience and over 5000 accrued teaching hours in their subject.

Globe Icon

Global

International Tuition

Based in Cambridge, with operations spanning the globe, we can provide our services to support your family anywhere.

Crest Icon

97%

Independent School Entrance Success

Our families consistently gain offers from at least one of their target schools, including Eton, Harrow, Wellington and Wycombe Abbey.

Book a free
30-minute consultation
session

At the Beyond Tutors we recognise that no two students are the same. 

That’s why we’ve transcended the traditional online tutoring model of cookie-cutter solutions to intricate educational problems. Instead, we devise a bespoke tutoring plan for each individual student, to support you on your path to academic success.

To help us understand your unique educational needs, we provide a free 30-minute consultation with one of our founding partners, so we can devise the tutoring plan that’s right for you.

To ensure we can best prepare for this consultation, we ask you to fill out the short form below.

Hire a Tutor

All the form fields are optional, but we ask you to provide as much information as possible so that we are in a better position to quickly meet your tutoring requirements.

Still have questions?
Let's get in touch