0% found this document useful (0 votes)
6 views3 pages

Python Network Analysis Basics

The document contains a series of questions related to Python programming and network analysis concepts. It covers topics such as computing sums, modifying dictionaries, graph creation using NetworkX, the PageRank algorithm, shortest path algorithms, link prediction methods, contagion models, centrality measures, and NetworkX functions for predicting links. Each question provides multiple-choice answers for the reader to select from.

Uploaded by

Sachin Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Python Network Analysis Basics

The document contains a series of questions related to Python programming and network analysis concepts. It covers topics such as computing sums, modifying dictionaries, graph creation using NetworkX, the PageRank algorithm, shortest path algorithms, link prediction methods, contagion models, centrality measures, and NetworkX functions for predicting links. Each question provides multiple-choice answers for the reader to select from.

Uploaded by

Sachin Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Which Python code correctly computes the sum of even numbers in the list L = [3, 5, 8, 2, 6]?

[] sum([x for x in L if x % 2 == 0])

[] sum([x for x in L if x % 2 != 0])

[] sum([x for x in L if x > 2])

[] sum(L)

2. You are given a dictionary d = {'A': 10, 'B': 20, 'C': 30}. Which Python code snippet correctly adds

a new key D with value 40 to the dictionary?

[] d['D'] = 40

[] [Link]('D', 40)

[] [Link]('D', 40)

[] [Link]({'D': 40})

3. Given the following Python code snippet, what will be the output?

[] A bar chart displaying the values in x and y

[] A line graph connecting the points (1,1), (2,4), (3,9), (4,16)

[] A scatter plot with points (1,1), (2,4), (3,9), (4,16)

[] A histogram displaying the values of x and y

4. Using the NetworkX library, how would you create an undirected graph with three nodes (A, B, C)

and two edges (A-B and B-C)?

[] G = [Link](); G.add_edges_from([('A', 'B'), ('B', 'C')])

[] G = [Link](); G.add_edges_from([('A', 'B'), ('B', 'C')])

[] G = [Link](); G.add_nodes_from(['A', 'B', 'C'])

[] G = [Link](); G.add_edges_from([('A', 'B'), ('B', 'C')], directed=True)

5. In the PageRank algorithm, what is the primary assumption regarding the link structure of the

web?

[] Pages that are linked to more often are likely more important
[] Pages that are less frequently linked are likely more important

[] Pages with more content are likely more important

[] Pages without links are considered equally important as those with links

6. In a social network, you are tasked with finding the shortest path between two individuals, A and

B. Which of the following algorithms would be most suitable?

[] Dijkstra's Algorithm

[] A* Search Algorithm

[] Breadth-First Search (BFS)

[] Depth-First Search (DFS)

7. Which of the following methods is commonly used for link prediction in a social network?

[] Collaborative Filtering

[] K-means Clustering

[] Matrix Factorization

[] Jaccard Similarity Index

8. In models of contagion in social networks, what does the term "threshold" specifically refer to?

[] The minimum number of links required to spread an infection in a network

[] The fraction of neighbors a node needs to be influenced by to adopt a new behavior

[] The time it takes for an infection to spread from one node to another

[] The maximum number of nodes that can be infected at any given time

9. Which centrality measure would you use to find the individuals who have the shortest average

path length to all other nodes in the network?

[] Degree Centrality

[] Closeness Centrality

[] Betweenness Centrality

[] Eigenvector Centrality
10. Which of the following NetworkX functions can be used to predict potential links in a network

based on node similarity indices?

[] nx.resource_allocation_index(G)

[] nx.shortest_path_length(G)

[] nx.closeness_centrality(G)

[] nx.betweenness_centrality(G)

You might also like