AddEdge() public method

public AddEdge ( GraphVizEdge edge ) : void
edge GraphVizEdge
return void
コード例 #1
0
ファイル: ControlFlowGraph.cs プロジェクト: WarlockD/GMdsam
 public GraphVizGraph ExportGraph()
 {
     GraphVizGraph graph = new GraphVizGraph();
     
     foreach (ControlFlowNode node in nodes)
     {
         graph.AddNode(new GraphVizNode(node.BlockIndex) { label = node.ToString(), shape = "box" });
     }
     foreach (ControlFlowNode node in nodes)
     {
         foreach (ControlFlowEdge edge in node.Outgoing)
         {
             GraphVizEdge e = new GraphVizEdge(edge.Source.BlockIndex, edge.Target.BlockIndex);
             switch (edge.Type)
             {
                 case JumpType.Normal:
                     break;
                 case JumpType.PopEnviroment:
                 case JumpType.PushEnviroment:
                     e.color = "pink";
                     break;
                 default:
                     e.color = "gray";
                     //e.constraint = false;
                     break;
             }
             graph.AddEdge(e);
         }
         if (node.ImmediateDominator != null)
         {
             graph.AddEdge(new GraphVizEdge(node.ImmediateDominator.BlockIndex, node.BlockIndex) { color = "green", constraint = false });
         }
     }
     return graph;
 }
コード例 #2
0
        public GraphVizGraph ExportGraph()
        {
            GraphVizGraph graph = new GraphVizGraph();

            foreach (ControlFlowNode node in nodes)
            {
                graph.AddNode(new GraphVizNode(node.BlockIndex)
                {
                    label = node.ToString(), shape = "box"
                });
            }
            foreach (ControlFlowNode node in nodes)
            {
                foreach (ControlFlowEdge edge in node.Outgoing)
                {
                    GraphVizEdge e = new GraphVizEdge(edge.Source.BlockIndex, edge.Target.BlockIndex);
                    switch (edge.Type)
                    {
                    case JumpType.Normal:
                        break;

                    case JumpType.PopEnviroment:
                    case JumpType.PushEnviroment:
                        e.color = "pink";
                        break;

                    default:
                        e.color = "gray";
                        //e.constraint = false;
                        break;
                    }
                    graph.AddEdge(e);
                }
                if (node.ImmediateDominator != null)
                {
                    graph.AddEdge(new GraphVizEdge(node.ImmediateDominator.BlockIndex, node.BlockIndex)
                    {
                        color = "green", constraint = false
                    });
                }
            }
            return(graph);
        }