Is CompoundGraph mutable or not??

Apr 30, 2012 at 1:56 AM

CompoundGraph implements IMutableCompoundGraph<V,E> which extends IMutableBidirectionalGraph<V,E>. My understanding of  mutability is a graph that can respond to mutations events (vertex add/remove, edge add/remove).


Yet, in GraphLayout.GraphElements, method RecreateGraphElements specifically excludes compound graphs from getting hooked up to those mutation events:


 if (!IsCompoundMode)
                    var mutableGraph = Graph as IMutableBidirectionalGraph<TVertex, TEdge>;
                    if (mutableGraph != null)
                        mutableGraph.VertexAdded += OnMutableGraph_VertexAdded;
                        mutableGraph.VertexRemoved += OnMutableGraph_VertexRemoved;
                        mutableGraph.EdgeAdded += OnMutableGraph_EdgeAdded;
                        mutableGraph.EdgeRemoved += OnMutableGraph_EdgeRemoved;


What is the danger of remove the if conditional above? That is, if it extends IMutableBidirectionalGraph, it should be able to respond to mutation.


Thanks in advance.