Question: Use NumPy, SciPy and Matplotlib, thanks! (python) Build function called is_adjacency which takes an input parameter A, a 2D NumPy array, and returns True if
Use NumPy, SciPy and Matplotlib, thanks! (python)
Build function called is_adjacency which takes an input parameter A, a 2D NumPy array, and returns True if A
A is the adjacency matrix of simple, connected, undirected graph and False otherwise. In other words, the function should return True if all the following conditions are met:
A is square.
All diagonal entries of A are 0
A is symmetric.
All off-diagonal entries of A are either 0 or 1. This implies that the graph associated with A is simple and undirected.
The multiplicity of the eigenvalue 0 in the Laplacian matrix L associated with A is 1. This implies that the graph associated with A is connected.

Problem 1 (7 points) Write a function called is_adjacency which takes an input parameter A , a 2D NumPy array, and returns True if A is the adjacency matrix of simple, connected, undirected graph and False otherwise. In other words, the function should return True if all the following conditions are met A is square. A is symmetric. All diagonal entries of A are 0 All off-diagonal entries of A are either 0 or 1. This implies that the graph associated with A is simple and undirected . The multiplicity of the eigenvalue 0 in the Laplacian matrix L associated with A is 1. This implies that the graph associated with A is connected. There are several NumPy functions that may be helpful such as numpy.diag, numpy.allclose and numpy.unique. Use any NumPy functions that you like The Laplacian matrix L of a graph G is defined as the matrix where the entry at index (1,1) is-1 if node i s connected to nodej, o if not and-di at the diagonal entry at index (i, i) where di is the degree of node i. The [degreel(https://en.wikipedia.org/wiki/Degree_(graph theory) of a node is the number of edges connected to that node. The degree of node i is the sum of row 1 in the adjacency matrix A . In other words, L = D-A where A is the adjacency matrix and D is the degree matrix For example, let G be the following graph: 6 5 4 1 2 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
