move to networkx lib