In[]:=
exampleFunc1[x_]:=Framed[exampleFunc2[x]+exampleFunc3[x]+exampleFunc4[x]]
In[]:=
exampleFunc2[x_]:=Framed[x]
In[]:=
exampleFunc3[x_]:=Framed[exampleFunc5[x]]
In[]:=
exampleFunc5[x_]:=Framed[x]
In[]:=
exampleFunc4[x_]:=Framed[exampleFunc6[x]+exampleFunc7[x]]
In[]:=
exampleFunc6[x_]:=If[x<=0,x,Framed[exampleFunc6[x-1]]]
In[]:=
exampleFunc7[x_]:=Framed[exampleFunc8[x]]
In[]:=
exampleFunc8[x_]:=Framed[exampleFunc9[x]]
In[]:=
exampleFunc9[x_]:=Framed[x]
In[]:=
globalFunctionList=Map[ToExpression[#,InputForm,DownValues]&,Names["Global`*"]];
In[]:=
globalFunctionList=Cases[globalFunctionList,List[RuleDelayed[name_HoldPattern,def_]]->{name,Hold[def]}];
In[]:=
globalFunctionList=Map[{ToString@InputForm@#[[1]],ToString@InputForm@#[[2]]}&,globalFunctionList];
In[]:=
globalFunctionList=Map[{StringReplace[#[[1]],"HoldPattern["~~fName__~~"["~~___~~"]]"->fName],#[[2]]}&,globalFunctionList];
In[]:=
globalFunctionList=Map[{#[[1]],StringReplace[#[[2]],"Hold["~~inner__~~"]"->inner]}&,globalFunctionList];
In[]:=
Grid[globalFunctionList,Frame->All]
Out[]=
exampleFunc1 | Framed[exampleFunc2[x] + exampleFunc3[x] + exampleFunc4[x]] |
exampleFunc2 | Framed[x] |
exampleFunc3 | Framed[exampleFunc5[x]] |
exampleFunc4 | Framed[exampleFunc6[x] + exampleFunc7[x]] |
exampleFunc5 | Framed[x] |
exampleFunc6 | If[x <= 0, x, Framed[exampleFunc6[x - 1]]] |
exampleFunc7 | Framed[exampleFunc8[x]] |
exampleFunc8 | Framed[exampleFunc9[x]] |
exampleFunc9 | Framed[x] |
In[]:=
functionPaths=Module[{allFuncNames,helperMakeEdges,paths},allFuncNames=globalFunctionList[[All,1]];helperMakeEdges[funcName_]:=Module[{matches},matches=Select[globalFunctionList,StringContainsQ[#[[2]],funcName]&];Map[DirectedEdge[#[[1]],funcName]&,matches](*EndHelperModule*)];paths=helperMakeEdges/@allFuncNames;Flatten@paths(*EndModule*)];
In[]:=
functionPathsGraph=Module[{vertices,edges,helperVertexLabelFunction},vertices=globalFunctionList[[All,1]];edges=functionPaths;helperVertexLabelFunction[v_]:=Module[{toolTipOptions},toolTipOptions={TooltipStyle->Directive[18,ShowStringCharacters->False,FontFamily->"Arial"]};Tooltip[ToString[v],SelectFirst[globalFunctionList,ToString[#[[1]]]==ToString[v]&][[2]],toolTipOptions](*EndHelperModule*)];Graph[vertices,edges,VertexLabels->(v_:>helperVertexLabelFunction[v])](*EndModule*)]