You'll have to use some other data file format since "edgelist"
doesn't handle isolated nodes (only edges).
"multiline_adjlist" should work:
In [1]: import networkx as nx
In [2]: G=nx.Graph()
In [3]: G.add_weighted_edges_from([('a','b',1),('c','d',2)])
In [4]: G.add_node('singleton')
In [5]: G.nodes()
Out[5]: ['a', 'c', 'b', 'd', 'singleton']
In [6]: nx.write_multiline_adjlist(G,'test.adj')
In [7]: H=nx.read_multiline_adjlist('test.adj')
In [8]: H.nodes()
Out[8]: ['a', 'c', 'b', 'd', 'singleton']
>
> This also led me to examine networkx's behavior with an empty graph,
> I've found some funky behavior on this edge case, using some methods
> on an empty graph throw an error, seems like maybe this should be
> either it's own exception or should be handled differently?
Many graph properties are not well defined for empty graphs. But
I'd like the failures in NetworkX to be obvious. So if there are cases
where either an error should be produced or special case should be provided
post those here or open a ticket at https://networkx.lanl.gov/trac/newticket
and we'll get them fixed.
Aric