Write graph in UCINET format to path. Parameters ---------- G : graph A EasyGraph graph path : file or string File or filename to write. Filenames ending in .gz or .bz2 will be compressed. Examples -------- >>> G=eg.path_graph(4) >>> eg.write_ucin
(G, path, encoding="UTF-8")
| 104 | |
| 105 | @open_file(1, mode="wb") |
| 106 | def write_ucinet(G, path, encoding="UTF-8"): |
| 107 | """Write graph in UCINET format to path. |
| 108 | Parameters |
| 109 | ---------- |
| 110 | G : graph |
| 111 | A EasyGraph graph |
| 112 | path : file or string |
| 113 | File or filename to write. |
| 114 | Filenames ending in .gz or .bz2 will be compressed. |
| 115 | Examples |
| 116 | -------- |
| 117 | >>> G=eg.path_graph(4) |
| 118 | >>> eg.write_ucinet(G, "test.net") |
| 119 | References |
| 120 | ---------- |
| 121 | See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm |
| 122 | for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm |
| 123 | """ |
| 124 | for line in generate_ucinet(G): |
| 125 | line += "\n" |
| 126 | path.write(line.encode(encoding)) |
| 127 | |
| 128 | |
| 129 | def parse_ucinet(lines): |
nothing calls this directly
no test coverage detected