`petgraph::data::Build` trait annotation when passing `petgraph::Graph`

Hi!

I have a function with the signature fn f<G>(graph: G) and a bunch of trait annotations. Since I want to use add_node on a local clone of graph, I added a petgraph::data:Build annotation to the function, too.

However, when invoking the function with a regular petgraph::Graph reference, it fails to compile as this object does not implement Build:

the trait `petgraph::data::Build` is not implemented for `&petgraph::graph_impl::Graph<...

This kind of makes sense, as it is not mutable, but I'd like to avoid passing it as mutable just to be able to construct a mutable clone.

Am I using it wrong? What would be the correct trait annotation in this case?

TIA!