# 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]]]
[[2], [[1], [3, 4, 5, 6, 7]]]
[[6], [[1, 2, 3, 4, 5], [7]]]
[[2, 6], [[1], [3, 4, 5], [7]]]
[[3, 5], [[1, 2], [4], [6, 7]]]
[[2, 4, 6], [[1], [3], [5], [7]]]


If we want to check some algebraic invariants then we use the following code. In particular PrimeBE(Primes[2]) 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[2]);


Dim(S/JG);

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

7
-------------------------------
PrimeBE(Primes[2]);

Ideal(x[2], y[2], -x[4]y[3] + x[3]y[4], -x[5]y[3] + x[3]y[5], -x[6]y[3] + x[3]y[6], -x[7]y[3] + x[3]y[7],
-x[5]y[4] + x[4]y[5], -x[6]y[4] + x[4]y[6], -x[7]y[4] + x[4]y[7],
-x[6]y[5] + x[5]y[6], -x[7]y[5] + x[5]y[7],
-x[7]y[6] + x[6]y[7])