More NetworkX 1.9 compatibility (shouldn't break backwards)