Starting from:
$30

$24

Social Computing Programming Assignment #1


Q1. Use python networkx library, to print the following properties of a given undirected graph:-

    (a) Number of nodes
    (b) Number of edges
    (c) Average degree
    (d) Average clustering coefficient.

Write your code inside the function analyze_network(G).

Test Case : On calling the function for complete graph with five nodes, the output should be as shown

below:-

Number of nodes = 5

Number of edges = 10

Average degree = 4.0

Average clustering coefficient = 1.0

Q2. Find out the number of edges required to connect a graph having ‘n’ number of nodes. Write your code inside the function find_num_edges(n).

Test Case : On calling the function for n=20, the output should be as shown below (the value may differ

due to randomness):-

Number of edges for connecting the graph = 28

Q3. Find the number of communities in the given graph using Girvan Newman algorithm. Write your code inside the function find_num_comm(G).

Test Case : On calling the function for friendship network of Zachary’s karate club, the output should be

as shown below:-

Number of communities = 2

Important Notes:

1)All the functions should be present in a single file named as scomp_asg01_<Your entry number>.py. For example if your entry number is 2014csz0001, your file name should be scomp_asg1_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) Your code will be tested on different test cases and will be evaluated accordingly, no marks will be given in case of syntactical errors.

More products