Here is one possibility using tikzmath
, but probably not "the best way".
\documentclass[border=7mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,math}
\tikzmath{
% function that draws the edge (\x1,\y1) -- (\x2,\y2)
% with label depending on: \l=0 => "a", \l=1 => "b"
% \c is a count downd counter, we stop at \c=0
function drawgen(\x1,\y1,\x2,\y2,\c,\l)
coordinate \p;
\p1 = (\x1 pt,\y1 pt);\p2 = (\x2 pt,\y2 pt);
if (\l < .5) then {let \g=a;let \a=above;} else {let \g=b;let \a=right;};
if (\x1 > \x2 || \y1 > \y2 ) then {let \e=^{-1};} else {let \e={};};
{
\draw[draw=red,-latex] (\px1,\py1) -- node[\a,pos=.55]{$\g\e$} (\px2,\py2);
};
if (\c > 0) then {
\c = \c-1;
\p3 = 1.5*(\px2,\py2)-.5*(\px1,\py1);
drawgen(\px2,\py2,\px3,\py3,\c,\l);
\p3 = (\px2,\py2)+.5*(\py2,\px2)-.5*(\py1,\px1);
drawgen(\px2,\py2,\px3,\py3,\c,1-\l);
\p3 = (\px2,\py2)-.5*(\py2,\px2)+.5*(\py1,\px1);
drawgen(\px2,\py2,\px3,\py3,\c,1-\l);
};
};
}
\begin{document}
\begin{tikzpicture}
\tikzmath{
\d=5cm; \n=3;
drawgen(0,0,\d,0,\n,0);
drawgen(0,0,-\d,0,\n,0);
drawgen(0,0,0,\d,\n,1);
drawgen(0,0,0,-\d,\n,1);
}
\end{tikzpicture}
\end{document}

UPDATE 1: In my first version, I forgot the $^{-1}$
. So I added the following line:
if (\x1 > \x2 || \y1 > \y2 ) then {let \e=^{-1};} else {let \e={};};
to set the power to -1
for edges going down and right. And as some overlaps appeared, I adjusted the edge label position.
UPDATE 2: As everybody goes with his own unlabeled method, here is one with math
tikz library.
\documentclass[border=7mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,math}
\begin{document}
\begin{tikzpicture}[scale=.02pt]
\tikzmath{
\power=2; \deviation=90; \numsteps=7; let \startcolor=green; let \endcolor=red;
function branch(\x,\y,\rotate,\step){ \step=\step-1;
if (\step >= 0) then { \mix = int(100*\step/(\numsteps-1));
{\draw[shift={(\x pt,\y pt)},scale=\power^\step, rotate=\rotate, color=\startcolor!\mix!\endcolor]
(0,0)--(1,0) coordinate(newbase);};
coordinate \b; \b1 = (newbase);
for \a in {-\deviation,0,\deviation}{
branch(\bx1,\by1,mod(\rotate+\a,360),\step);
};
};
};
for \angle in {0,90,180,-90}{
branch(0,0,\angle,\numsteps);
};
}
\end{tikzpicture}
\end{document}

With the parameters:
\power=2.3; \deviation=70; \numsteps=7; let \startcolor=magenta; let \endcolor=black;

With the parameters:
\power=2.5; \deviation=120; \numsteps=7; let \startcolor=black; let \endcolor=orange;
