updated function calls to use networkx functions