Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Please! CHW5.3. Six degrees of separation: How are we connected? It's said that everyone in the world is connected to each other by

In Python Please!image text in transcribed

CHW5.3. Six degrees of separation: How are we connected? 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 truly 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.all(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

Students also viewed these Databases questions