JSON output with NetworkX graphs