I have already added nodes into my graph but i cant seem to understand the way to add the edges to it. The edges correspond to any value of 1 in my pivot tabel. The table is of the following form:
movie_id 1 2 3 4 5 ... 500
user_id ...
501 1.0 0.0 1.0 0.0 0.0 ... 0.0
502 1.0 0.0 0.0 0.0 0.0 ... 0.0
503 0.0 0.0 0.0 0.0 0.0 ... 1.0
504 0.0 0.0 0.0 1.0 0.0 ... 0.0
. ...
.
1200
This is the code i have used for my nodes:
B = nx.Graph()
B.add_nodes_from(user_rating_pivoted.index, bipartite=0)
B.add_nodes_from(user_rating_pivoted.columns, bipartite=1)
And i imagine the edges should be formed in a similar way :
add_edges_from(...) for idx, row in user_rating_pivoted.iterrows())