The old approach had the big problem that Edges were duplicated multiple times. Therefore, changing an edge by e.g. Graph::edge_mut can result in out of sync information between edges, edges_in and edges_out.
The new approach still allows fast lookup of edge targets (successors/predecessors), but avoids the duplication by storing vertex indices instead.
Another fix for this problem would be to use ref-counted edges instead.
The old approach had the big problem that Edges were duplicated multiple times. Therefore, changing an edge by e.g.
Graph::edge_mut
can result in out of sync information betweenedges
,edges_in
andedges_out
.The new approach still allows fast lookup of edge targets (successors/predecessors), but avoids the duplication by storing vertex indices instead.
Another fix for this problem would be to use ref-counted edges instead.