Converted pandas dataframe to networkx graph