to_graph6_bytes#
- to_graph6_bytes(G, nodes=None, header=True)[源代码]#
将简单的无向图转换为GRAPH6格式的字节。
- 参数
- G图表(非定向)
- nodes: list or iterable
节点按提供的顺序标记为0...n-1。如果没有,则由
G.nodes()
是使用的。- header: bool
如果为True,则将GRAPH6<<‘字节添加到数据头.
- 加薪
- NetworkXNotImplemented
如果图是有向的或是多重图。
- ValueError
如果该图至少具有
2 ** 36
节点;GRAPH6格式仅为阶数小于2 ** 36
。
参见
from_graph6_bytes
,read_graph6
,write_graph6_bytes
笔记
返回的字节以换行符结尾。
该格式不支持边或节点标签、平行边或自循环。如果存在自循环,则会静默忽略它们。
工具书类
实例
>>> nx.to_graph6_bytes(nx.path_graph(2)) b'>>graph6<<A_\n'