# How can an algorithm be written in Mathematica language in a scientific paper? [duplicate]

I have a scientific research in which I used an algorithm in an optimized language to simplify the calculations, which is important and should be included in the paper.

Algorithm

matr = Graph[
Table[i, {i, 1, 5}], {1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3,
3 <-> 2, 2 \[DirectedEdge] 4, 3 <-> 4, 3 \[DirectedEdge] 5,
CN = MapIndexed[
If[Equal @@ #2, 1, # Subscript[x, ## & @@ #2]] &, #, {2}] &@matr;
n = 5;
n1 = 7;
ClearAll[a]
a[m_, r_] :=
Module[{inds = DeleteCases[Range@Length@m, r]},
Table[m[[i, j]] + If[i != j, 1, 0] m[[i, r]] m[[r, j]], {i,
inds}, {j, inds}]]
a[CN, 2];
ai = Nest[a[#, 2] &, CN, n - 2];
Mipaths = Expand[Part[ai, 1, 2]];
baseSet[Mipaths_] :=
Denominator[#2/#1] == 1 &]
baseSet[Mipaths];
rep[fn_] := fn /. Subscript[a_, i_, j_] /; i > j :> Subscript[a, j, i];
M = rep@baseSet[Mipaths];
var = Variables[M];
M1 = var # & /@ CoefficientRules[M][[All, 1, 1]] /.
Subscript[x, i_, j_] -> 1


The question is how can it be written scientifically in the paper as an algorithm? As shown in these papers as an example  