first attempts with networkx instead of pygraph. partially passing tests