Adjacency matrix. Given a relation relation (as a numpy.array, see example below) and number of nodes n, define a function adjacency to construct the adjacency matrix A (as a numpy.array).You can assume that n is a positive integer and treat relation as a list of directed edges. # Example from p112 of VMLS relation = np.array([[1, 2], [1, 3], [2, 1], [2, 4], [3, 4], [4, 1]]) n = 4 # Modify the function adjacency below with your answer for Q8 def adjacency(relation, n): A = None ########################### ### YOUR CODE HERE ######## ## REMOVE THIS LINE-------- raise NotImplementedError() ## ------------------------ ########################### return A
Concepts in Designing Database
A database design is the process of data organization based on a database model. The process deals with identifying what data should be stored in a database and how data elements relate to each other.
Entity Relationship Diagram
Complex real-world applications call for large volumes of data. Therefore, it is necessary to build a great database to store data safely and coherently. The ER data model aids in the process of database design. It helps outline the structure of an organization’s database by understanding the real-world interactions of objects related to the data. For example, if a school is tasked to store student information, then analyzing the correlation between the students, subjects, and teachers would help identify how the data needs to be stored.
Adjacency matrix. Given a relation relation (as a numpy.array, see example below) and number of nodes n, define a function adjacency to construct the adjacency matrix A (as a numpy.array).You can assume that n is a positive integer and treat relation as a list of directed edges.
# Example from p112 of VMLS
relation = np.array([[1, 2], [1, 3], [2, 1], [2, 4], [3, 4], [4, 1]])
n = 4
# Modify the function adjacency below with your answer for Q8
def adjacency(relation, n):
A = None
###########################
### YOUR CODE HERE ########
## REMOVE THIS LINE--------
raise NotImplementedError()
## ------------------------
###########################
return A
Step by step
Solved in 3 steps with 1 images