Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create a list of friends for each user. This can be conveniently stored in a list of lists. use python to solve question 3 In
create a list of friends for each user. This can be conveniently stored in a list of lists.
use python to solve question 3
In this exercise you will perform some simple analvses in order to gain more experience wi Python. We'll use the following toy network as a test example: o(3,2 7 0 14 114 etween two nodes, say i The values in the nodes represent user ids. The existence of a and j, means that users i and j are related (they are friends, or collaborate with each other, etc.). For the purpose of this exercise we'll interpret the relation as friendship. Thus, users 7 and 9 are friends but 7 and 3 are not. For the rest of the homework let n denote the number of nodes and m the number of links. 1. Create a list of users users using the following assignment of ids to names: 0 "Harry, 1 "Dave" 2 "Sue" 3 'Chuck', 4 "Theo" 5', "Clay" 6 "Hugo" 7 "Dan" 8 "Kate" 9 "Kip Thus, Hugo gets id 6, for example. You may assume that ids are always assigned sequentially 2. Create a list friends of pairs (tuples) to represent the relation depicted in the graph above. A pair (i,j) in the relation means that j is a friend of i and i is a friend of j (or that they know each other, work together, etc.). Thus, (2,4) should be one the tuples ends because Sue and Theo are friends. 3. Create a list of friends for each user. This can be conveniently stored in a list of lists. For example, [4,6] is the list of friends of the user with id 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started