rustworkx
rustworkx copied to clipboard
read graphs from graph6, sparse6 and digraph6 fromats
What is the expected enhancement?
graph6, sgraph6 and digraph6 formats
Formal definition of these formats are available here
It would the equivalent implementation of nx.from_sparse6_bytes in networkx
def from_sparse6_bytes(string)
""" Read an undirected graph in sparse6 format from string.
Parameters: string
Data in sparse6 format
Returns: PyGraph
""""
>>> G = rx.from_sparse6_bytes(b"A_")
<rustworkx.PyGraph object at 0x7efe8bbb2c10>
In the meantime, one could do one the following:
- read graph via
networkxand userx.networkx_converter - implement a function that reads sparse6 format and manually adds nodes and edges to a
PyGraphobject - convert sparse6 format to an equivalent graphML format
This seems to be a rather niche format, but I’d accept PRs implementing it.
We can implement it from scratch or fork https://crates.io/crates/graph6-rs and adapt it to use petgraph’s graph data structures
Hi @IbrahimElk @IvanIsCoding Please assign to me. thx~