MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / write_ucinet

Function write_ucinet

easygraph/readwrite/ucinet.py:106–126  ·  view source on GitHub ↗

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")

Source from the content-addressed store, hash-verified

104
105@open_file(1, mode="wb")
106def 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
129def parse_ucinet(lines):

Callers

nothing calls this directly

Calls 2

generate_ucinetFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected