Wouldn't the Data.Graph.Inductive representation of a graph satisfy this (It might not be O(1), but it's pretty close)? I must admit that I find it hard to see what a zipper for a graph should look like, though.
I know how to get a zipper for a static graph by Tying the Knot (http://haskell.org/haskellwiki/Tying_the_Knot). But writing one where you can add and remove nodes and edges seems much harder.
You already know how a zipper for a tree looks like. And you have probably seen a functional queue. Generalizing from both of those, you can imagine how a zipper would work.
I can write down the types and all, even if I don't know of any implementation. But that's probably a topic for a blog post, or so.
You already know how a zipper for a tree looks like. And you have probably seen a functional queue. Generalizing from both of those, you can imagine how a zipper would work.
I can write down the types and all, even if I don't know of any implementation. But that's probably a topic for a blog post, or so.