Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It's said that everyone in the world is connected to each other by at most six degrees of separation. For example, you know someone who

image text in transcribed

It's said that everyone in the world is connected to each other by at most six degrees of separation. For example, you know someone who knows someone who knows someone who knows someone who knows someone who knows someone who knows the president of the United States. Of course, this can never be trul tested, but scientists and mathematicians estimate that it could be much less. A study found that Twitter users are on average connected to each other through a chain of at most 4 people. You will write a function which checks whether or not every pair of people from a group is connected by at most a certain degree of separation. Your function should take in a graph (as an adjacency matrix) and a distance and should then return True if every pair of nodes is connected by a walk of at most the specified distance, and False otherwise. Hints: - np.al1( matrix > ) will return True if all of the entries of matrix are positive and False otherwise. - la.matrix_power (M,n) will return the n-th power of M - What do the entries on the diagonal of an adjacency matrix represent? How do their values relate to the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions