termsgroupByVariables = ListKeySort @ GroupBy[List @@ myEq[x1#, x2Variables @ Level[#, x3{-1}] &, x4];Total] &;
groups = KeySortgroupByVariables @ GroupBy[termsmyEq[x1, Variables[Level[#x2, {-1}]] &x3, Total]x4]
<|{} -> 5,
{x1} -> Cos[x1] + Sin[x1/2],
{x2} -> Tan[x2],
{x3} -> -Cos[x3],
{x1, x2} -> Cot[x1 x2],
{x1, x3} -> -Tan[x1/x3],
{x2, x4} -> -Tan[x2 - x4],
{x1, x2, x3} -> Sin[x1 x2 x3],
{x2, x3, x4} -> Sin[x2 + x3/x4],
{x1, x2, x3, x4} -> Cot[x1 + x2 + x3 + x4] - Sin[x1 - x2 - x3/x4]|>
Graph[Join[Keys @ groups, Values @ groups],
KeyValueMap[DirectedEdge] @ groups,
ImageSize -> Large,
VertexCoordinates -> Join @@
(Thread[{#, Rescale @ Range @ Length @ Keys @ groups}]& /@ {1, 2}),
VertexLabels -> {v_ :> Placed["Name", If[MemberQ[Keys @ groups, v], Before, After]]}]