now runs much faster after removing networkx lib