Update for compatibility with last networkx library.