private Set <CallGraph> BFSTranspose(Dictionary <int, CGNode> nodesOrder) { Set <CallGraph> cgs = new Set <CallGraph>(); List <CGNode> qeue = new List <CGNode>(); Set <CGNode> visited = new Set <CGNode>(); int cNodes = nodesOrder.Count; for (int i = cNodes - 1; i >= 0; i--) { CGNode n = nodesOrder[i]; CallGraph cg = new CallGraph(); if (!visited.Contains(n)) { qeue.Add(n); visited.Add(n); while (qeue.Count > 0) { CGNode mn = qeue[0]; visited.Add(mn); cg.AddNode(mn); qeue.RemoveAt(0); foreach (CGEdge e in calls.EdgesTo(mn)) { if (!visited.Contains(e.Src)) { visited.Add(e.Src); // DIEGO-CHECK: I dont remember why I inverted this cg.AddEdge(new CGEdge(e.Dst, e.Label, e.Src, e.IsVirtual)); qeue.Add(e.Src); } } } } if (cg.cgNodes.Count > 1) { cgs.Add(cg); } } return(cgs); }