public void ModifyGraph() { DirectedGraphImpl <string> gr = CreateAcyclicGraph(); gr.AddNode("3"); gr.AddEdge("0", "3"); gr.AddEdge("1", "3"); gr.RemoveEdge("1", "2"); string sExp = "(0 s:(1 2 3 ) p:( )) (1 s:(3 ) p:( 0 2 )) (2 s:(1 ) p:( 0 )) (3 s:() p:( 0 1 )) "; string s = DumpGraph(gr); Assert.AreEqual(sExp, s); gr.RemoveEdge("2", "1"); gr.RemoveEdge("0", "1"); gr.RemoveEdge("0", "2"); sExp = "(0 s:(3 ) p:( )) (1 s:(3 ) p:( )) (2 s:() p:( )) (3 s:() p:( 0 1 )) "; s = DumpGraph(gr); Assert.AreEqual(sExp, s); }
public void EdgeCountAfterRemove() { DirectedGraphImpl<string> gr = new DirectedGraphImpl<string>(); gr.AddNode("a"); gr.AddNode("b"); Assert.AreEqual(0, gr.Successors("a").Count); gr.AddEdge("a", "b"); gr.RemoveEdge("a", "b"); Assert.AreEqual(0, gr.Successors("a").Count); Assert.AreEqual(0, gr.Predecessors("b").Count); }
public void RemoveCaller(Statement stm) { if (!graphStms.Nodes.Contains(stm)) { return; } var callees = this.Callees(stm).ToArray(); foreach (var callee in callees) { graphStms.RemoveEdge(stm, callee); } }