Using in R the package 'igraph' and calling the function:
graph <- graph.empty(10,directed=FALSE)
write.graph(graph,"some/path/graph.txt",format="edgelist")
If I recall the graph by using
g <- as.undirected(read.graph("some/path/graph.txt",format="edgelist"))
the graph is empty but has also NO vertices!
An edgelist is a matrix with 2 columns with a row for each edge, first column indicating the source node and second column the node of destination. Since you have no edges the edgelist is empty and hence the file you write is empty.
Usually the edgelist is the simplest way of storing a graph, and the number of nodes can be inferred from the number of unique node names in the edgelist (or highest integer if nodes are numbered, which I think is what igraph does), but it goes wrong if there are nodes with no edges,
You can try another format that also stores information on the nodes. e.g.,
library("igraph")
graph <- graph.empty(10,directed=FALSE)
write.graph(graph,"graph.txt",format="pajek")
g <- as.undirected(read.graph("graph.txt",format="pajek"))