networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
generate_gexf(G, encoding='utf-8', prettyprint=True, version='1.2draft')

"GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics" .

Notes

This implementation does not support mixed graphs (directed and undirected edges together).

The node id attribute is set to be the string of the node label. If you want to specify an id use set it as node data, e.g. node['a']['id']=1 to set the id of node 'a' to 1.

Parameters

G : graph
A NetworkX graph :
encoding : string (optional, default: 'utf-8')
Encoding for text data. :
prettyprint : bool (optional, default: True)
If True use line breaks and indenting in output XML. :
version : string (default: 1.2draft)
Version of GEFX File Format (see http://gexf.net/schema.html) :
Supported values: "1.1draft", "1.2draft" :

Generate lines of GEXF format representation of G.

Examples

>>> G = nx.path_graph(4)
... linefeed = chr(10) # linefeed=
>>> s = linefeed.join(nx.generate_gexf(G))
... for line in nx.generate_gexf(G): # doctest: +SKIP
...  print(line)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.readwrite.gexf.generate_gexf

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/readwrite/gexf.py#91
type: <class 'function'>
Commit: