I cannot create a .graph file from Python and the only thing that I can create is a .gexf
file with:
networkx.write_gexf(graph, "test.gexf")
It didn't work with:
networkx.write_gexf(graph, "test.gephi")
According to networkX documentation. The point of this function is to:
Write G in GEXF format to path.
With G
being a graph.
In order to obtain a .gephi
file I would suggest opening the .gexf
obtained from networkX with Gephi and saving as a .gephi
.
Steps in pictures(example):
.gexf
file:some_graph = nx.path_graph(4)
nx.write_gexf(some_graph, "some_graph.gexf")
According to the Gephi Quick Start Tutorial:
Saving your project [as a .gephi file] encapsulates all data and results in a single session file.
The .gephi
file format is meant to be used as a "session file", not to be used as an import file for Gephi.
Instead a specific file format(.gexf
) was created by the Gephi project:
GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics.
(see further info about this file format here)
If you need/want a graph saved as a file, use one of these formats.
With GEXF always being the most liberating one(allowing more features).
However, If you need/want to save a session after manipulating a graph using Gephi, use .gephi
.
For our example above: