to_sparse6_bytes#

to_sparse6_bytes(G, nodes=None, header=True)[源代码]#

将无向图转换为稀疏6格式的字节。

参数
G图表(非定向)
nodes: list or iterable

节点按提供的顺序标记为0...n-1。如果没有,则由 G.nodes() 是使用的。

header: bool

如果为True,则将稀疏6<<‘字节添加到数据头.

加薪
NetworkXNotImplemented

如果图是有向的。

ValueError

如果该图至少具有 2 ** 36 节点;稀疏6格式仅为阶数小于 2 ** 36

参见

to_sparse6_bytes, read_sparse6, write_sparse6_bytes

笔记

返回的字节以换行符结尾。

该格式不支持边缘或节点标签。

工具书类

1

图形6规范<https://users.cecs.anu.edu.au/~bdm/data/formats.html>

实例

>>> nx.to_sparse6_bytes(nx.path_graph(2))
b'>>sparse6<<:An\n'