In my code I built nodes, username, and urlsCleaned with the edges being between the username and urlsCleaned. I want to build the edges between urls to other urls(urls being the nodes). The way I want the edges to be built is if a user in the dataframe NWO_data uses two separate urls in different tweets then it should build the edge between the url nodes. How would I go about doing this? The dataframe has these columns: username, name, tweet, language, mentions, urls, replies_count retweets_count, likes_count, hashtags, link, retweet. The same user can be in multiple rows because they can have multiple tweets.
import csv
import twint
import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import nest_asyncio
import re
nest_asyncio.apply()
NWO_data = pd.read_csv("TwitterLinksNWO.csv")
NWO_data["urlsCleaned"] = NWO_data["urls"]
import networkx as nx
US_graph = nx.from_pandas_edgelist(NWO_data,source="username", target="urlsCleaned")
type(US_graph)
nx.info(US_graph)
plt.figure(figsize=(40,40))
nx.draw_networkx(US_graph)
plt.show