Interior mutability help

Hi,

For short the code is here. I want to be able to mutate simultaneously the nodes in the graph and any other field (for instance the ordering). This however I can not achieve if I have Vec<Expr> which is why I changed it to RefCell. However, now I get this compilation error, which I understand why I get it. However, I did not think of any approach to go around it, could anyone help with any suggestion.

Just to give a more detail essentially I need to be able to mutate different parts of the struct simultanously, however methods like the get above fails in this situation.

Graph data structures are hard to do in safe Rust. Maybe this can help you: Learning Rust With Entirely Too Many Linked Lists

I agree with ConnyOnny the link provided is a great example that helps to understand the problem better. I would also want to point you toward the following two posts:

and
http://smallcultfollowing.com/babysteps/blog/2015/04/06/modeling-graphs-in-rust-using-vector-indices/