0
$\begingroup$

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, 
 4 \[DirectedEdge] 5}] // AdjacencyMatrix;
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_] := 
 DeleteDuplicates[SortBy[MonomialList[Mipaths], {Head, Length}], 
  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 enter image description here enter image description here

Please answer if possible

$\endgroup$
1
  • $\begingroup$ I'll only note that some papers both post the Mathematica code (especially if it's very compact) and a verbal description of how the code is doing what it's doing. $\endgroup$ Aug 1, 2022 at 9:52

0