AdjacencyMatrix: Representing a Graph by a Matrix
Learn about the representation of graphs by matrix and lists.
We'll cover the following...
An adjacency matrix is a way of representing an n
vertex graph by an matrix, a
, whose entries are boolean values.
Press + to interact
class AdjacencyMatrix(object):def __init__(self, n):self.n = nself._initialize()def _initialize(self):self.a = new_boolean_matrix(self.n, self.n)
The matrix entry a[i][j]
is defined as
...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy