rustworkx icon indicating copy to clipboard operation
rustworkx copied to clipboard

Add `from_dot` to create rustworkx graphs from dot files

Open IvanIsCoding opened this issue 8 months ago • 2 comments

What is the expected enhancement?

Follow up of #840 (related: #1091, #1464)

We have to_dot methods in both PyGraph and PyDiGraph.

Ideally, we would also like to have a rustworkx.from_dot to read those files and reconstruct a graph

IvanIsCoding avatar Jun 17 '25 12:06 IvanIsCoding

Also, please check https://crates.io/crates/dot-parser for its old petgraph feature. It is tied to an old version of petgraph but it could be used as a reference implementation.

IvanIsCoding avatar Jun 17 '25 12:06 IvanIsCoding

dot-parser has an incompatible. However, we could use the grammar from Pydot (https://github.com/pydot/pydot) with Pest ( https://docs.rs/pest/latest/pest/) maybe?

https://crates.io/crates/graphviz-rust is another option that we could use for a reference.

IvanIsCoding avatar Jun 18 '25 02:06 IvanIsCoding

Hey @IvanIsCoding, could you take a look? PR

Krishn1412 avatar Aug 10 '25 09:08 Krishn1412