# An algorithm to compute the primary decomposition of binomial edge ideals

In the paper Cohen-Macaulay binomial edge ideals of small deviation by Giancarlo Rinaldo, (section 3), we describe an algorithm to compute primary decomposition of a binomial edge ideal. Here is a preprint of the article.

In this page we give an example of this computation by the routines that we implemented in CoCoA which are downloadable from here. We refer to the article for an in-depth description of the algorithm.

As done in the article we want to calculate the primary decomposition of the binomial edge ideals associated to the connected graphs described in the example 3.1 of Section 3. For this purpose we have to load the file primaryDec.coc and after defining the edges of the graph, we call the function PrimaryDecBE(L, Nv) that returns a list of of pairs where the first element is a set of vertices with the cutpoint property and the second is a list of set of vertices of the connected components related to the first element. We show the input and the output in the console.


Source "primaryDec.coc";
L:=[
[1,2],
[2,3],
[2,5],
[3,4],
[4,5],
[3,6],
[5,6],
[6,7]
];

Nv:=7;

Primes:=PrimaryDecBE(L, Nv);
For I:=1 To Len(Primes) Do
PrintLn(Primes[I]);
EndFor;



[[ ], [[1, 2, 3, 4, 5, 6, 7]]]
[, [, [3, 4, 5, 6, 7]]]
[, [[1, 2, 3, 4, 5], ]]
[[2, 6], [, [3, 4, 5], ]]
[[3, 5], [[1, 2], , [6, 7]]]
[[2, 4, 6], [, , , ]]


If we want to check some algebraic invariants then we use the following code. In particular PrimeBE(Primes) gives the prime ideal related to the 2nd element of the list Primes.

Use S::=Q[x[1..Nv],y[1..Nv]];

Nl:=Len(L);

Edge:=NewList(Nl);
For I:=1 To Nl Do
Edge[I]:=x[L[I,1]]*y[L[I,2]]-y[L[I,1]]*x[L[I,2]];
EndFor;
JG:=Ideal(Edge);
Dim(S/JG);
Depth(S/JG);

PrimeBE(Primes);


Dim(S/JG);

8
-------------------------------
Depth(S/JG);

7
-------------------------------
PrimeBE(Primes);

Ideal(x, y, -xy + xy, -xy + xy, -xy + xy, -xy + xy,
-xy + xy, -xy + xy, -xy + xy,
-xy + xy, -xy + xy,
-xy + xy)