Write G in GEXF format to path. "GEXF (Graph Exchange XML Format) is a language for describing complex networks structures, their associated data and dynamics" [1]_. Node attributes are checked according to the version of the GEXF schemas used for parameters which are not user defi
(G, path, encoding="utf-8", prettyprint=True, version="1.2draft")
| 16 | |
| 17 | |
| 18 | def write_gexf(G, path, encoding="utf-8", prettyprint=True, version="1.2draft"): |
| 19 | """Write G in GEXF format to path. |
| 20 | |
| 21 | "GEXF (Graph Exchange XML Format) is a language for describing |
| 22 | complex networks structures, their associated data and dynamics" [1]_. |
| 23 | |
| 24 | Node attributes are checked according to the version of the GEXF |
| 25 | schemas used for parameters which are not user defined, |
| 26 | e.g. visualization 'viz' [2]_. See example for usage. |
| 27 | |
| 28 | Parameters |
| 29 | ---------- |
| 30 | G : graph |
| 31 | An EasyGraph graph |
| 32 | path : file or string |
| 33 | File or file name to write. |
| 34 | File names ending in .gz or .bz2 will be compressed. |
| 35 | encoding : string (optional, default: 'utf-8') |
| 36 | Encoding for text data. |
| 37 | prettyprint : bool (optional, default: True) |
| 38 | If True use line breaks and indenting in output XML. |
| 39 | version: string (optional, default: '1.2draft') |
| 40 | The version of GEXF to be used for nodes attributes checking |
| 41 | |
| 42 | Examples |
| 43 | -------- |
| 44 | >>> G = eg.path_graph(4) |
| 45 | >>> eg.write_gexf(G, "test.gexf") |
| 46 | |
| 47 | """ |
| 48 | writer = GEXFWriter(encoding=encoding, prettyprint=prettyprint, version=version) |
| 49 | writer.add_graph(G) |
| 50 | writer.write(path) |
| 51 | |
| 52 | |
| 53 | def generate_gexf(G, encoding="utf-8", prettyprint=True, version="1.2draft"): |
nothing calls this directly
no test coverage detected