Added networkx solution.