diff --git a/assets/sigma_o2.svg b/assets/sigma_o2.svg index 33965bd6..c70a8acb 100644 --- a/assets/sigma_o2.svg +++ b/assets/sigma_o2.svg @@ -4,427 +4,427 @@ - - + + ComputationalGraph - + ReturnNode - -Return + +Return g18636 - -G -1 + +G +1 g18652 - - + + g18636->g18652 - - + + g18717 - - + + g18636->g18717 - - + + g18719 - - + + g18636->g18719 - - + + g18643 - -G -2 + +G +2 g18644 - - + + g18643->g18644 - - + + g18637 - -V -3 + +V +3 g18637->g18644 - - --1.0 + + +-1.0 g18651 - - + + g18644->g18651 - - + + g18650 - -G -4 + +G +4 g18650->g18651 - - + + g18651->g18652 - - + + g18653 - - + + g18652->g18653 - - + + g18630 - -V -5 + +V +5 g18630->g18653 - - --1.0 + + +-1.0 g18682 - - + + g18630->g18682 - - --1.0 + + +-1.0 g18691 - - + + g18630->g18691 - - --1.0 + + +-1.0 g18706 - - + + g18630->g18706 - - --1.0 + + +-1.0 g18630->g18706 - - --1.0 + + +-1.0 g18698 - - + + g18630->g18698 - - --1.0 + + +-1.0 g18702 - - + + g18630->g18702 - - --1.0 + + +-1.0 g18721 - - + + g18653->g18721 - - + + g18721->ReturnNode - - + + g18676 - -V -6 + +V +6 g18676->g18682 - - + + g18676->g18691 - - + + g18694 - - + + g18682->g18694 - - + + g18682->g18698 - - + + g18691->g18694 - - + + g18691->g18702 - - + + - + -g18710 - - +g18714 + + - + -g18694->g18710 - - --1.0 +g18694->g18714 + + +-1.0 - + -g18706->g18710 - - --1.0 +g18706->g18714 + + +-1.0 - + -g18711 - - +g18715 + + - + -g18710->g18711 - - +g18714->g18715 + + g18708 - -G -7 + +G +7 - + -g18708->g18711 - - +g18708->g18715 + + - + -g18715 - - +g18711 + + - + -g18708->g18715 - - +g18708->g18711 + + g18709 - -G -8 + +G +8 - + -g18709->g18711 - - +g18709->g18715 + + - + -g18709->g18715 - - +g18709->g18711 + + - + -g18711->g18717 - - +g18715->g18717 + + g18722 - - + + g18717->g18722 - - + + - + -g18714 - - +g18710 + + - + -g18698->g18714 - - --1.0 +g18698->g18710 + + +-1.0 - + -g18702->g18714 - - --1.0 +g18702->g18710 + + +-1.0 - + -g18714->g18715 - - +g18710->g18711 + + - + -g18715->g18719 - - +g18711->g18719 + + g18719->g18722 - - --0.5 + + +-0.5 g18722->ReturnNode - - + + diff --git a/src/backend/to_dot.jl b/src/backend/to_dot.jl index 410e63ab..fb226c3f 100644 --- a/src/backend/to_dot.jl +++ b/src/backend/to_dot.jl @@ -7,14 +7,13 @@ end function to_dotstatic(::Type{ComputationalGraphs.Sum}, id::Int, subgraphs::Vector{Graph{F,W}}, subgraph_factors::Vector{F}) where {F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$(id)[shape=box, label = <($factor)*⊕>, style=filled, fillcolor=cyan,fontsize=18]" - opr_node = "g$(id)[shape=box, label = <⊕>, style=filled, fillcolor=cyan,fontsize=18]" + opr_node = "g$(id)[shape=box, label = <>, style=filled, color= darkturquoise, fontsize=18, width = 0.5, height = 0.4]\n" node_temp *= opr_node for (g, gfactor) in zip(subgraphs, subgraph_factors) if gfactor != 1 - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16, penwidth = 0.2,arrowsize = 0.3]\n" else - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,penwidth = 0.2,arrowsize = 0.3]\n" end end return node_temp, arrow_temp @@ -23,14 +22,13 @@ end function to_dotstatic(::Type{ComputationalGraphs.Prod}, id::Int, subgraphs::Vector{Graph{F,W}}, subgraph_factors::Vector{F}) where {F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$id[shape=box, label = <($factor)⊗>, style=filled, fillcolor=cornsilk,fontsize=18]\n" - opr_node = "g$id[shape=box, label = <⊗>, style=filled, fillcolor=cornsilk,fontsize=18]\n" + opr_node = "g$id[shape=box, label = <>, style=filled, color=lightpink, fontsize=18, width = 0.5, height = 0.4]\n" node_temp *= opr_node for (g, gfactor) in zip(subgraphs, subgraph_factors) if gfactor != 1 - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16,penwidth = 0.2,arrowsize = 0.3]\n" else - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,penwidth = 0.2,arrowsize = 0.3]\n" end end # end @@ -40,13 +38,12 @@ end function to_dotstatic(::Type{ComputationalGraphs.Power{N}}, id::Int, subgraphs::Vector{Graph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$id[shape=box, label = <($factor)*Pow($N)>, style=filled, fillcolor=darkolivegreen,fontsize=18]\n" - opr_node = "g$id[shape=box, label = , style=filled, fillcolor=darkolivegreen,fontsize=18]\n" + opr_node = "g$id[shape=box, label = , style=filled, color=darkolivegreen,fontsize=18, width = 0.8, height = 0.4]\n" node_temp *= opr_node if subgraph_factors[1] != 1 - arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,label=$gfactor,fontsize=16]\n" + arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,label=$gfactor,fontsize=16, penwidth = 0.2,arrowsize = 0.3]\n" else - arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,]\n" + arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee, penwidth = 0.2,arrowsize = 0.3]\n" end return node_temp, arrow_temp end @@ -54,15 +51,14 @@ end function to_dotstatic(::Type{ComputationalGraphs.Sum}, id::Int, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$(id)[shape=box, label = <($factor)*⊕>, style=filled, fillcolor=cyan,fontsize=18]" - opr_node = "g$(id)[shape=box, label = <⊕>, style=filled, fillcolor=cyan,fontsize=18]" + opr_node = "g$(id)[shape=box, label = <>, style=filled, color=darkturquoise ,fontsize=18, width = 0.5, height = 0.4]\n" opr_name = "g$id" node_temp *= opr_node for (g, gfactor) in zip(subgraphs, subgraph_factors) if gfactor != 1 - arrow_temp *= "g$(g.id)->$opr_name[arrowhead=vee,label=$gfactor,fontsize=16]\n" + arrow_temp *= "g$(g.id)->$opr_name[arrowhead=vee,label=$gfactor,fontsize=16,penwidth = 0.2,arrowsize = 0.3]\n" else - arrow_temp *= "g$(g.id)->$opr_name[arrowhead=vee,]\n" + arrow_temp *= "g$(g.id)->$opr_name[arrowhead=vee, penwidth = 0.2,arrowsize = 0.3]\n" end end return node_temp, arrow_temp @@ -71,14 +67,13 @@ end function to_dotstatic(::Type{ComputationalGraphs.Prod}, id::Int, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$id[shape=box, label = <($factor)⊗>, style=filled, fillcolor=cornsilk,fontsize=18]\n" - opr_node = "g$id[shape=box, label = <⊗>, style=filled, fillcolor=cornsilk,fontsize=18]\n" + opr_node = "g$id[shape=box, label = <>, style=filled, color=lightpink,fontsize=18, width = 0.5, height = 0.4]\n" node_temp *= opr_node for (g, gfactor) in zip(subgraphs, subgraph_factors) if gfactor != 1 - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,label=$gfactor,fontsize=16,penwidth = 0.2,arrowsize = 0.3]\n" else - arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,]\n" + arrow_temp *= "g$(g.id)->g$(id)[arrowhead=vee,penwidth = 0.2,arrowsize = 0.3]\n" end end # end @@ -88,13 +83,12 @@ end function to_dotstatic(::Type{ComputationalGraphs.Power{N}}, id::Int, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W} node_temp = "" arrow_temp = "" - # opr_node = "g$id[shape=box, label = <($factor)*Pow($N)>, style=filled, fillcolor=darkolivegreen,fontsize=18]\n" - opr_node = "g$id[shape=box, label = , style=filled, fillcolor=darkolivegreen,fontsize=18]\n" + opr_node = "g$id[shape=box, label = , style=filled, color=darkolivegreen,fontsize=18, width = 0.8, height = 0.4]\n" node_temp *= opr_node if subgraph_factors[1] != 1 - arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,label=$(subgraph_factors[1]),fontsize=16]\n" + arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,label=$gfactor,fontsize=16, penwidth = 0.2, arrowsize = 0.3]\n" else - arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee,]\n" + arrow_temp *= "g$(subgraphs[1].id)->$opr_name[arrowhead=vee, penwidth = 0.2, arrowsize = 0.3]\n" end return node_temp, arrow_temp end @@ -110,7 +104,7 @@ end """ function to_dot_str(graphs::AbstractVector{<:AbstractGraph}, name::String="") head = "digraph ComputationalGraph { \nlabel=\"$name\"\n" - head *= "ReturnNode[shape=box, label = \"Return\", style=filled, fillcolor=darkorange,fontsize=18]\n" + head *= "ReturnNode[shape=box, label = \"Return\", style=filled, color=wheat3, fontsize=18]\n" body_node = "" body_arrow = "" leafidx = 1 @@ -128,7 +122,7 @@ function to_dot_str(graphs::AbstractVector{<:AbstractGraph}, name::String="") if isempty(subgraphs(g)) #leaf g_id in inds_visitedleaf && continue leafname = get_leafname(g, leafidx) - gnode_str = "g$g_id[label=<$leafname>, style=filled, fillcolor=paleturquoise,fontsize=18]\n" + gnode_str = "g$g_id[label=<$leafname>, style=filled, color=lightcyan, fontsize=18]\n" body_node *= gnode_str leafidx += 1 push!(inds_visitedleaf, g_id) @@ -140,7 +134,7 @@ function to_dot_str(graphs::AbstractVector{<:AbstractGraph}, name::String="") push!(inds_visitednode, g_id) end if isroot - body_arrow *= "g$(g_id)->ReturnNode[arrowhead=vee,]\n" + body_arrow *= "g$(g_id)->ReturnNode[arrowhead=vee, penwidth = 0.2, arrowsize = 0.3]\n" rootidx += 1 end end