Network代写|COMP 598 Homework 9 – Network Modeling

本次加拿大作业是一个Python计算机网络模型的Network代写Homework

Non-standard (i.e., not built-in) python libraries you can use:

– Pandas
– networkx
– numpy

In this assignment, we’re going to practice the fundamentals of network modeling by analyzing the conversation network of the My Little Ponies.

Task 1: Build the MLP interaction network (15 pts)

In this assignment, we are modeling the interaction network as who speaks to who. There is an (undirected) edge between two characters that speak to one another. The weight of the edge is how many times they speak to one another.

To keep our life simple, we’re going to use a very simple proxy for “speaking to one another”. We will say that character X speaks to character Y whenever character Y has a line IMMEDIATELY after character X in an episode. So, for the following excerpt of dialog from an episode…

In this excerpt, we have the following interactions:

Of course, from the text, we can see that Pinkie Pie’s comment wasn’t *really* addressed to Apple Jack… highlighting how proxies can be wrong. But for this assignment, we’re going to assume it’s a good proxy.

Keep the following in mind:

Your script, build_interaction_network.py, should work as follows

python build_interaction_network.py -i /path/to/<script_input.csv> -o
/path/to/<interaction_network.json>

where the interaction network json file should have structure…

{
“twilight sparkle”: {
“spike”: <# of interactions between twilight sparkle and spike>,
“applejack”: <# of interactions between ts and aj>,
“pinkie pie”: <# of interactions between ts and pp>,

},
“pinkie pie”: {
“twilight sparkle”: <# of interactions between ts and pp>

} .
..
}

For consistency, lowercase all character names in the output JSON.

As usual, the arguments -i and -o should take any path (i.e. we will call them with our own files, which can be in any location). Indentation won’t matter in this exercise; you can have a one-line JSON file or a pretty-printed one.