easygraph.readwrite.ucinet module#

Read and write graphs in UCINET DL format. This implementation currently supports only the ‘fullmatrix’ data format. Format —— The UCINET DL format is the most common file format used by UCINET package. Basic example: DL N = 5 Data: 0 1 1 1 1 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 .. rubric:: References

See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm

easygraph.readwrite.ucinet.generate_ucinet(G)[source]#

Generate lines in UCINET graph format. :param G: A EasyGraph graph :type G: graph

Examples

Notes

The default format ‘fullmatrix’ is used (for UCINET DL format).

References

See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm

easygraph.readwrite.ucinet.parse_ucinet(lines)[source]#

Parse UCINET format graph from string or iterable. Currently only the ‘fullmatrix’, ‘nodelist1’ and ‘nodelist1b’ formats are supported. :param lines: Data in UCINET format. :type lines: string or iterable

Returns:

G

Return type:

EasyGraph graph

See also

read_ucinet

References

See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm

easygraph.readwrite.ucinet.read_ucinet(path, encoding='UTF-8')[source]#

Read graph in UCINET format from path. :param path: File or filename to read.

Filenames ending in .gz or .bz2 will be uncompressed.

Returns:

G

Return type:

EasyGraph MultiGraph or MultiDiGraph.

Examples

>>> G=eg.path_graph(4)
>>> eg.write_ucinet(G, "test.dl")
>>> G=eg.read_ucinet("test.dl")
To create a Graph instead of a MultiGraph use
>>> G1=eg.Graph(G)

See also

parse_ucinet

References

See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm

easygraph.readwrite.ucinet.write_ucinet(G, path, encoding='UTF-8')[source]#

Write graph in UCINET format to path. :param G: A EasyGraph graph :type G: graph :param path: File or filename to write.

Filenames ending in .gz or .bz2 will be compressed.

Examples

>>> G=eg.path_graph(4)
>>> eg.write_ucinet(G, "test.net")

References

See UCINET User Guide or http://www.analytictech.com/ucinet/help/hs5000.htm for full format information. Short version on http://www.analytictech.com/networks/dataentry.htm