void RecGraph(MainForm frm, string file)
        {

            var g = new CompoundGraph<object, IEdge<object>>();

            var map = new Dictionary<uint, CodeBlock>();

            string[] ent = File.ReadAllText(file).Split(new string[] { "block:" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string e in ent)
            {
                string[] st = e.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                var entr = new CodeBlock();

                entr["block"] = st[0];

                for (int i = 1; i < st.Length; i++)
                {
                    if (st[i] == "{")
                        break;
                    else
                    {
                        string[] lst = st[i].Split(new char[] { ':' }, 2);
                        if (lst.Length == 2)
                        {
                            entr[lst[0]] = lst[1];
                        }
                    }
                }

                map[entr.block] = entr;
            }

            map = map.Where(x => x.Value.runs > 0).ToDictionary(x => x.Key, x => x.Value);

            long v = map.Sum(x => x.Value.cost);

            CodeBlock.gcost = v;

            double runcumsum = 0;

            var intrnode = map.Values.OrderByDescending(x => x.cost).Where(x => (runcumsum += x.cost) < 0.60 * v).Take(1000).ToList();

            var varp = intrnode.Select(x => x.hash);

            long v1 = intrnode.Sum(x => x.cost);

            foreach (var r in intrnode)
            {
                g.AddVertex(r);
            }

            var newstuff = new List<CodeBlock>();

        reloop:
            foreach (var r in intrnode)
            {
                CodeBlock va, vb;


                if (map.TryGetValue(r["pNextBlock"], out va))
                {
                    if (!g.ContainsVertex(va)) { newstuff.Add(va); g.AddVertex(va); v1 += va.cost; }

                    g.AddEdge(new Edge<object>(r, va));
                }

                if (map.TryGetValue(r["pBranchBlock"], out vb))
                {
                    if (!g.ContainsVertex(vb)) { newstuff.Add(vb); g.AddVertex(vb); v1 += vb.cost; }

                    g.AddEdge(new Edge<object>(r, vb));
                }
            }

            if (newstuff.Count != 0)
            {
                intrnode = newstuff;
                newstuff = new List<CodeBlock>();
                goto reloop;
            }

            frm.Text = "Showing " + v1 * 100 / v + "% (using " + g.VertexCount + " out of " + map.Count + ", " + g.VertexCount * 100 / map.Count + "% of blocks)";


            var ordlst = map.Values.OrderByDescending(x => x.cost).ToList();

            double rvv = 0;



            foreach (var i in ordlst)
            {
                rvv += i.cost;
                i.cumsum = rvv;
            }

            var cs = frm.chart2.Series.Add("CumSum(cost) / decrease(cost)");
            var pr = frm.chart1.Series.Add("Cost / addr");
            var bl = frm.chart1.Series.Add("gopc / addr");
            var gs = frm.chart1.Series.Add("cycl / addr");

            cs.ChartType = SeriesChartType.StepLine;

            pr.ChartType = SeriesChartType.BoxPlot;
            bl.ChartType = SeriesChartType.BoxPlot;
            gs.ChartType = SeriesChartType.BoxPlot;

            foreach (var i in ordlst)
            {
                cs.Points.AddY(i.cumsum * 100.0 / CodeBlock.gcost);
            }

            rvv = 0;
            foreach (var i in ordlst.OrderBy(x => x.pos))
            {
                rvv += i.cost;
                //if (rvv > v * 0.01)
                {
                    pr.Points.AddXY(i.pos, Math.Log(i.cost + 1));
                    bl.Points.AddXY(i.pos, Math.Log(i.guest_opcodes + 1));
                    gs.Points.AddXY(i.pos, Math.Log(i.guest_cycles / 4 + 1));
                }
            }
            /*
            var vertices = new string[30];
            
            for (int i = 0; i < 30; i++)
            {
                vertices[i] = i.ToString();
                g.AddVertex(vertices[i]);
            }
            
            for (int i = 6; i < 15; i++)
            {
                g.AddChildVertex(vertices[i % 5], vertices[i]);
            }
            g.AddChildVertex(vertices[5], vertices[4]);
            g.AddChildVertex(vertices[5], vertices[2]);
            g.AddChildVertex(vertices[16], vertices[0]);
            g.AddChildVertex(vertices[16], vertices[1]);
            g.AddChildVertex(vertices[16], vertices[3]);
            g.AddChildVertex(vertices[16], vertices[20]);
            g.AddChildVertex(vertices[16], vertices[21]);
            g.AddChildVertex(vertices[16], vertices[22]);
            g.AddChildVertex(vertices[16], vertices[23]);
            g.AddChildVertex(vertices[16], vertices[24]);
            g.AddChildVertex(vertices[4], vertices[25]);
            g.AddChildVertex(vertices[4], vertices[26]);
            g.AddChildVertex(vertices[4], vertices[27]);

            g.AddEdge(new Edge<object>(vertices[0], vertices[1]));
            g.AddEdge(new Edge<object>(vertices[0], vertices[2]));
            g.AddEdge(new Edge<object>(vertices[2], vertices[4]));
            g.AddEdge(new Edge<object>(vertices[0], vertices[7]));
            g.AddEdge(new Edge<object>(vertices[8], vertices[7]));
            //g.AddEdge(new Edge<object>(vertices[13], vertices[12]));
            g.AddEdge(new Edge<object>(vertices[3], vertices[20]));
            g.AddEdge(new Edge<object>(vertices[20], vertices[21]));
            g.AddEdge(new Edge<object>(vertices[20], vertices[22]));
            g.AddEdge(new Edge<object>(vertices[22], vertices[23]));
            g.AddEdge(new Edge<object>(vertices[23], vertices[24]));
            g.AddEdge(new Edge<object>(vertices[0], vertices[28]));
            g.AddEdge(new Edge<object>(vertices[0], vertices[29]));
            g.AddEdge(new Edge<object>(vertices[25], vertices[27]));
            g.AddEdge(new Edge<object>(vertices[26], vertices[25]));
            g.AddEdge(new Edge<object>(vertices[14], vertices[27]));
            g.AddEdge(new Edge<object>(vertices[14], vertices[26]));
            g.AddEdge(new Edge<object>(vertices[14], vertices[25]));
            g.AddEdge(new Edge<object>(vertices[26], vertices[27]));
            */

            layout.LayoutMode = LayoutMode.Automatic;
            layout.LayoutAlgorithmType = "CompoundFDP";
            layout.OverlapRemovalConstraint = AlgorithmConstraints.Automatic;
            layout.OverlapRemovalAlgorithmType = "FSA";
            layout.HighlightAlgorithmType = "Simple";

            /*
            using (FileStream w = File.Create("c:\\fail.bin"))
                g.SerializeToBinary(w);
            */

            layout.Graph = g;
        }