Cannot create a directed graph using from_pandas_dataframe from networkx
Instead of a dataframe you can write edgelist, it works for me, it shows me an error when I used from_pandas_dataframe : "AttributeError: module 'networkx' has no attribute 'from_pandas_dataframe
"
Solution :
Graph = nx.from_pandas_edgelist(df,source='source',target='destination', edge_attr=None, create_using=nx.DiGraph())
You can test if your graph is directed or not using: nx.is_directed(Graph)
. You will get True.
Add the optional keyword argument create_using=nx.DiGraph(),
tw_small = nx.from_pandas_dataframe(edges_df[:300],source='from',
target='to',edge_attr=True,
create_using=nx.DiGraph())