Starting from:
$35

$29

Social Computing Programming Assignment #2

Note: The questions given in the assignment are entirely based on the video lectures related to Fatman Hypothesis. We will be using the same example graph comprising of nodes as either person or foci, where each person would be having a bmi value and would be assigned to one of the given foci. The number of person nodes or foci nodes may vary, so do not assume it yourself and find it using the graph taken as an input parameter. For further details you can refer the related videos.

Q1. Implement the code for homophily and place it inside the function homophily(G). Your function should return two values, first the initial number of edges in the graph and second the updated number of edges after adding more edges based on the concept of homophily.

Test Case : On calling the function for the example graph with 100 person nodes and five foci nodes, it should return 100 and 130. The second value may vary based on randomness.

Q2. Implement closure for the given graph under the function closure(G). Your function should return two values, first the initial number of edges and second the final number of edges after adding them based on the closure. The function will be called after calling homophilly function.

Test Case: On calling the function for the example graph with 100 person nodes and five foci nodes, it may return 130 and 155. The first value returned by the function should match with the second value returned by the homophily function and the second value may vary based on randomness.

Q3. Implement the function change_bmi on a given graph G (i.e. change_bmi(G))using one foci node namely ‘eat_out’. Your function should return two values, first the initial number of nodes having bmi value as 40 and second the number of nodes having bmi value as 40 after updating their bmi values. The function will be called after calling closure function.

Test Case: On calling the function for the example graph with 100 person nodes and five foci nodes, it may return 1 and 3. The values may vary based on randomness.



Important Notes:

1)All the functions should be present in a single file named as scomp_asg02_<Your entry number>.py. For example if your entry number is 2014csz0001, your file name should be scomp_asg02_2014csz0001.py. (use only small letters)

    2) Make sure you do not copy the code neither from internet nor from any other student.

    3) Strictly follow the guidelines given regarding the format of the output and use Python3.

    4) No marks will be given in case of syntactical errors.

More products