def to_bytes(graph, protocol=HIGHEST_PROTOCOL):
"""Converts a graph to bytes with pickle. Note that the pickle module has some incompatibilities between Python
2 and 3. To export a universally importable pickle, choose 0, 1, or 2.
:param BELGraph graph: A BEL network
:param int protocol: Pickling protocol to use
:return: Pickled bytes representing the graph
:rtype: bytes
.. seealso:: https://docs.python.org/3.6/library/pickle.html#data-stream-format
"""
raise_for_not_bel(graph)
return dumps(graph, protocol=protocol)
评论列表
文章目录