Added networkx graph functionality