Amplitude bases in generic EFTs

We present for the first time an efficient algorithm to find a basis of kinematically independent structures built of (massless and massive) spinor helicity variables in four dimensions. This method provides a classification of independent contact terms for the scattering amplitudes with generic masses, spins, and multiplicity in any effective field theory (EFT). These contact terms are in one-to-one correspondence with a complete set of irrelevant operators in the EFT. As basic applications of our method, we classify the D2nF4 contact terms in SU(N) Yang-Mills theory for n ≤ 8, dimension-six operators involving five W±, Z and γ vector bosons, and spin-tidal effective interactions for spin-1 massive particles in gravitational theories.


Introduction
On-shell methods [1][2][3][4][5] have proved to be extremely powerful in the study of effective field theories (EFTs). Among other applications, in recent years, they appeared as prominent tools in the study of Standard Model Effective Field Theories (SMEFT) and gravitational binary systems.
In the context of EFTs at weak coupling, the on-shell programme provides us with an alternative to the standard Lagrangian EFTs, where the information of the theory beyond the IR physics is encoded by adding irrelevant operators. In particular, it exists a one-to-one correspondence between irrelevant independent operators and minimal amplitudes, i.e. terms in the low-energy expansion of the S-matrix which are polynomial in the kinematic variables (and are linear in the Wilson coefficients). This means that from the S-matrix perspective the classification and enumeration of independent operators [46][47][48][49][50] are equivalent to finding a basis of kinematically independent polynomial structures in the amplitudes [51,52]. From these "building blocks", higher-point tree-level amplitudes can be constructed from knowledge of factorisation channels, using recursion relations [12,[53][54][55][56][57][58], and loop-level amplitudes through generalised unitarity techniques [59][60][61][62][63][64][65].
The classification programme was carried out mainly in four dimensions where we take advantage of the simplicity of the massless [66][67][68][69] and massive [70] spinor helicity formalism. In particular, recent works on various aspects of this classification and applications to the SMEFT are [71][72][73][74][75][76][77][78][79][80][81][82][83]. Generic techniques to classify fully massless interactions have been worked out in these works, while a general method for massive particles with any mass, spin, and multiplicity is still lacking. The authors of [73,80] introduced a unbolding/bolding procedure to classify massive structures from their massless counterparts, and they presented a strategy to tackle this problem for four-point contact terms and particles with spin S ≤ 1. An alternative strategy valid for any multiplicity and any spin has been presented in [84], but this method does not allow for a clear one-to-one correspondence between independent structures and operators.
In this paper, we present an alternative method to classify generic contact terms in fourdimension, for any mass, spin and multiplicity n (with n ≥ 4, the classification for n = 3 is known [70,73,85,86]), starting from the graph method presented in [12], strengthen by the unbolding/bolding procedure of [73,80] which we implement at the level of graphs. In this algorithm, structures involving powers of any mass are always regarded kinematically independent of structures with fewer powers of mass. This allows for a clear one-to-one correspondence between independent contact terms and operators in massive EFTs. In the following, we skip an introductory section on the correspondence between operators and contact terms, for which we refer to the papers mentioned above.
The paper is organised as follows. In section 2 we review the graph method introduced in [12], giving more details on the algorithm and its implementation. In section 3 we will extend the method to structures involving massive spinor variables. In section 4, we work out explicitly three examples: the classification of D 2n F 4 operators in SU(N ) Yang-Mills theories, dimension-six interactions between (charged and uncharged) massive and massless vectors, and quadratic-in-spin (spin-)tidal interactions in gravity. Finally, in appendix A JHEP08(2022)299 The graph associate to the kinematic structures 23 31 3 [12] 2 [14][32] and 23 34 [13][14] [25] respectively. we review the spinor helicity formalism and fix our conventions, and in appendix B we present a strategy to evaluate (massive) spinor structures on rational kinematics, based on momentum twistors. Appendix C shows some technical details on the algorithms for planar graphs.
The algorithms presented in the article have been implemented in the Mathematica package MassiveGraphs, which makes use of the SpinorHelicity package. Some of the functions are already publicly available and an Example.nb notebook has been provided.

Kinematic structures from graphs
A simple way to find all possible Lorentz invariant structures in four dimensions is to identify them with an oriented graph with two types of edges, where each vertex is associated with a particle, and the edges correspond to angles (red) or squares (blue) SL(2, C) invariants, as shown in figure 1 1 . The orientation of the edges then keeps track of the ordering in the spinor brackets and thus provides potential minus signs.
The valency of each vertex is given by two natural i is the helicity of the i th particle. In general, we consider polynomial structures with an arbitrary number of momentum insertions n ∂ ≥ 0. Each momentum in the structure can be assigned to any of the n states, which increases the valency of the corresponding vertex by (1,1). Then the number of momenta associated with each vertex is min{v i a , v i s }. Moreover, for reasons which will become clear in the next section, it is crucial to consider a circular embedding for our graphs, i.e. we take all the vertices to be ordered points on a circle.
We can associate to each graph a couple of n × n adjacency matrices (A, S), whose elements are non-negative integer numbers: each element A ij ≥ 0 (or S ij ≥ 0) indicates the number of red (or blue) edges going from the i th -vertex to the j th -vertex. Finally, there is a trivial map M from the adjacency matrices to the corresponding polynomial spinor structure:  [34]. Then Schouten identities are equivalent to untying crossings for both the two kinds of edges (red and blue) in the graph.
This map is in general non-invertible, because the spinor brackets are antisymmetric ). Then we restrict without lost of generality to upper-half triangular adjacency matrices (A ij = 0 and S ij = 0 if i ≥ j), in order to make the correspondence between polynomial structures and graphs one-to-one. At this point, we are interested in finding a basis of structures that are independent up to Schouten identity and momentum conservation. Notice that the former acts separately on the angle and square invariants, while the latter mixes the two structures. In the following sections, we will show how to deal with these identities in terms of the graphs mentioned above.

Schouten identities
Schouten identities for angle and square brackets read Thinking of the kinematic structures in terms of graphs, specifically using the circular embedding already mentioned, if (i 1 , i 2 , i 3 , i 4 ) are arranged in cyclic order, we notice that i 1 i 3 i 2 i 4 correspond to intersecting edges in the graph, while i 1 i 2 i 3 i 4 and i 2 i 3 i 1 i 4 do not (the same is true for the square brackets). This is illustrated in figure 2 2 . In a generic graph, this relation can be applied recursively a finite number of times until we end up with a sum over graphs that do not have any crossings. It is then clear that a basis for kinematic structures that are independent under Schouten identity can be obtained by classifying all planar graphs associated with a polynomial kinematic structure. The planarity of the graph translates into a sharp condition on the adjacency matrices associated to it: for any i = 1, . . . , n and j = i + 2, . . . , n − 1. In particular, the number of crossings of a graph is given by the sum where the extrema of the sums are consistent with the restriction to upped-half triangular adjacency matrices.

JHEP08(2022)299
This also provides an algorithmic method to write any non-planar structure in terms of planar ones. Indeed, if we consider a graph (A, S) for which, for example, the red edges are non-planar, i.e. if in (2.3) any of the A kl = 0, then we can recursively untie the corresponding crossing(s) using Applying such decomposition a finite number of times, every non-planar structure can be written as a linear combination of planar ones. A proof of this statement is given in appendix C. This algorithm can be used to find a basis of SU(2) singlets in the tensor product of any finite-dimensional representation of the SU(2) group. In fact, any tensor that transforms in a representation 2 q + 1 can be written as a totally symmetric tensor T a 1 ··· aq = T (a 1 ··· aq) , where a i are indices in the fundamental of SU (2). The singlets are given by contractions of any product of tensors of this kind with a 1 a 2 = − a 2 a 1 and the Schouten identities are equivalent to [a 1 a 2 a 3 ]a 4 = 0 . (2.8) Then to any tensor T we can associate a vertex with valency q, and the edges correspond to contractions of two SU(2) indices through an a i a j . Any loop is then automatically zero because T a 1 ···a i ···a j ···an a i a j = 0 . (2.9) This observation is useful if we want to apply our method to select a basis of independent SU(2) gauge structures (see for example [12]), or when we will consider polynomial structures with masses involved because the little group for massive particles in four dimensions is exactly SU (2). This could also be applied to the Lorentz group SL(2, C), because the finite-dimensional representations are in one-to-one correspondence with those of SU(2) × SU(2).

Momentum conservation
Momentum conservation is more subtle and does not have a clear graph-based interpretation. On the other hand, the classification above allows for a massive simplification and the conditions to find a basis of spinor structures independent, up to both Schouten identity and momentum conservation, are easy to implement. We can take into account most of the relations coming from momentum conservation simply by excluding the momentum of the n th -particle from the previous assignment. Then the n th -vertex will have valency ( |hn|+hn 2 , |hn|−hn 2 ) 3 . This is equivalent to imposing the 3 Fully eliminating the momentum of the n th -particle is a matter of choices and in principles we could choose any other particle. (2.10) and we can discard from our basis any graph whose adjacency matrix does not satisfy the conditions A in = 0 or S jn = 0 , (2.11) for any i, j = 1, . . . , n − 1. However, this is not the end of the story, because there are in general n additional momentum conservation conditions that do not involve any insertions of the momentum of the n th particles:

JHEP08(2022)299
which are a consequence of the equation of motion for free particles p n αα λα n = 0 = λ α n p n αα . If h n = 0 the valency of the n th vertex is (0, 0) and there is only one additional condition to consider: As already noticed in the previous section, Schouten identities do not change the valency of vertices in the multigraph, so they do not change the number of momenta associated with each vertex. Then, we have to find a set of elements in our planar basis which can be written as a linear combination of the others via momentum conservation. Once we have discarded all the polynomial structures in which we find the momentum of the n th -particle, we need to carefully discard the structures that maximise their appearance in conditions (2.12) and (2.13). Since the edges (1, n) and (n − 1, n) are always planar, the natural choice is to isolate terms where either p 1 or p n−1 appears and to write the additional momentum conservation conditions as 4 4 This is an actual choice between momenta of the 1 st and the n − 1 th momenta. We could choose an equivalent basis by writing (2.12) as hn < 0 .

JHEP08(2022)299
Notice that also the structures (n − 1)1 [1n] (for h n > 0, or s 1 n−1 and n1 [1n − 1] in the other cases) are always planar, because any source of non-planarity would come from in invariants, which are always excluded by our choice of eliminating any momentum insertions of the n th -particle. In other words, the valency of the n th -vertex is (h n , 0) and (0, h n ) for h n ≤ 0 and h n > 0, respectively. The conditions on the adjacency matrices for the polynomial structures to be in our basis are trivial. We are going to write them in the case h n < 0 for simplicity: Moreover, equations (2.14) provide an algorithmic way of writing linear relations of the structures in terms of the elements of our basis.

A summary of the algorithm
In this section, we elaborate on the algorithms that follow from the considerations discussed in the previous sections. In particular, we present, step-by-step, how to find a basis of kinematically independent minimal amplitudes associated with a given particle content (or field content of the associated irrelevant operators) and a specified mass dimension. In our discussion, we will avoid complications coming from colour structures, which have been treated carefully elsewhere in the literature, e.g. [48,78].
1. We start with an initial trivial assignment of nodes valencies determined by the field content of the operators we want to consider. In this step, we choose the arbitrary ordering of the particles in the circular embedding.
2. Accordingly to their mass dimension, such operators can have a number n ∂ of derivatives. These derivatives correspond to momenta insertions in the associated minimal amplitudes. Then, we must consider all the permutations of the partitions of n ∂ momentum insertions into at most n − 1 integers. By doing so, we have already taken into account the conditions (2.11) coming from momentum conservation, i.e. we exclude any insertion of n th momentum.
3. Each momentum insertion modifies the valency of nodes, as explained in 2.1. Then, we have a set of possible valency assignations for the graphs and we need to generate the corresponding structures which are kinematically independent: (a) We classify all the planar graphs with the valency assignment just found.

JHEP08(2022)299
(b) From this set of graphs, we exclude those not satisfying the conditions (2.15).
(c) Using the map M, we write down our basis of kinematically independent spinor structures. 5 4. Operators may involve multiple insertions of the same field, i.e. we have identical particles in the minimal amplitude. For a detailed discussion see [50,87]. In these cases, the set of kinematically independent structures does not correspond to an independent basis of EFT operators. In practice, we consider all the previously classified independent structures and we act on them with a proper Young projector over the labels of the identical states, as explained for example in section 3.2.2 of reference [12]. When summing over permutations we introduce terms which are not elements of our planar basis and we need an algorithm to write them as a linear combination of such elements. 6 (a) The inverse map M −1 gives the graphs associated with such structures.
(b) We apply recursively (2.5) (both for the angles and squares invariants) a finite number of times to write such graph as a sum of planar terms.
(c) We might end up with terms which do not satisfy (2.11) or (2.15). Such terms must also be decomposed in our basis and the graph operations, equivalent to (2.10), is Similarly we take into account the relations (2.14). Obviously, such operations never introduce negative powers of the Lorentz invariant structures, by construction.
(d) After applying momentum conservation identities, the terms in the sum might not be all planar and we have to recursively apply (2.5) again.

5.
After this decomposition we end up with linear combinations of terms in the chosen basis and transforming properly under permutations of the particles.
6. Finally we check whether there is a linear relation between such terms.

Checking the algorithm
We performed several non-trivial checks on the algorithm just presented. 5 Each of the previous steps can be visualised in the Mathematica package MassiveGraphs, using the function UniformMassStructures (which perform the classification) and setting the option Echos to True. 6 This second part of the algorithm has not been made publicly available in the MassiveGraphs code yet. On the other hand, an older version (valid only for purely massless structures) can be found in the Mathematica package HelicityStructures and the function is called AllIdentities.

JHEP08(2022)299
1. The procedure seems to rely a lot on the cyclic order chosen for the vertices of the graphs and the momenta which we want to eliminate (using momentum conservation and equation of motion). Different choices correspond simply to different but equivalent bases for the kinematic structures. We checked that the number of elements in the basis does not depend on these choices in many non-trivial examples, involving several particles, also with higher helicity, and a high number of momenta insertions.
2. Generating all the graphs we classify all the corresponding structures. We verified numerically (on rational kinematic, as explained in appendix B) that the relations we find through our algorithm are correct and that they are all.
(a) In particular, once the basis {b i } i=1,...,N is generate, we might ask whether additional identities exist, which have not been considered in our approach. If such relation exist, we can find rational non-zero coefficients We generate N independent rational kinematics and evaluate the r.h.s. of the previous equation. By doing so we obtain a homogeneous linear system of N equations in N variables and, if its solution is α i = 0 ∀i, we checked the full independence of the elements of the basis.
We evaluate N +1 times both l.h.s. and r.h.s. on random rational kinematics and we obtain an inhomogeneous linear system of M × (N + 1) equations in M × N variables. If a solution exists, we have verified completeness. We can also check the solution against the linear relations found from the graphic decomposition described in detail in the previous section.
We always found that the bases were complete and their elements independent in several non-trivial cases. The linear relations match with the results of the graphic decomposition.

The massive basis
The classification of independent structures in massive theories involves more technical considerations, but a generalisation of the method presented above for fully massless theories is possible. The sources of such additional complications are two: JHEP08(2022)299 In section 2, we identified a basis of structures B = {b i } such that any other combination of spinors with the proper mass dimension and helicity configuration can be written as a linear combination of b i 's.
When dealing with massive particles, we fix the helicity category 7 and the mass dimension of the structures. We can identify a set of structures such that any element within the above-mentioned helicity category can be written as a linear combination in this basis. On the other hand, the latter will contain terms proportional to m i , m i (through the equation of motion) and p 2 i , which are redundant when we exploit the correspondence between polynomial kinematic structures and irrelevant operators.
Then, for a specified helicity category (S 1 , . . . , S n ) and mass dimension ∆, we will identify different bases that are relevant for different purposes: • Kinematic basis: any spinorial structures within the chosen helicity category and mass dimension can be written as a linear combination of the terms in the basis. This basis contains also structures in different helicity categories, multiplied by powers of the masses. Such basis is the relevant one when we test our method numerically on rational kinematics as explained in section 2.5 or we are interested in building an ansatz for amplitudes (for example, see [12]).
• Helicity category basis: any term proportional to m i or m i is ruled out. This gives a basis of structures that are kinematically independent of each other modulo identities across different helicity categories. This basis is the relevant one when we classify independent minimal amplitudes in order of the mass dimension of the corresponding EFT operators. For example, when classifying terms of mass dimension ∆, any terms proportional to m i or m i have already been considered with arbitrary coefficients in the basis for terms with mass dimension ∆ − 1. This will allow us to work effectively up to terms proportional to any power of the masses.

The massive little group
When dealing with combinations of massive spinors, we must distinguish between spinors whose little group indices are contracted and those with free indices (to which we will refer as free spinors). Since we are interested in structures that transform under irreducible representations of the little group, the free indices associated with a particle will automatically JHEP08(2022)299 LG indices (3.1) are again equivalent to untying crossings of edges anchored to the spin and momentum vertices associated with the same particle.
be fully symmetric. 8 This distinction suggests that we have to associate different vertices in the graph with each momentum (momentum vertices) and free spinor (spin vertex). Schouten identities for the little group can involve either a momentum or a free spinor (p iαα λ I iβ or p iαα λ I iβ ) or two momenta p iαα p iββ . We will show in detail that Schouten identities are again equivalent to untying the crossing of two edges, both anchored to momentum vertices and/or to the spin vertices. Indeed, considering the combinations mentioned above, with p iαα = λ I iα λ iαI and antisymmetrising over two little group group indices, we find and their "conjugates", which are identical to the relations one would find applying the antisymmetrisation directly over the SL(2, C) indices. We show their graph representation in figure 3. We should emphasise a crucial point: since we are looking for a basis of polynomial structures with a well-defined notion of mass ordering, momentum vertices must be all succeeding (or all preceding) the spin vertex. Indeed, we want the combinations which are proportional to higher powers of the mass to be always planar. This is not guaranteed if the condition mentioned above is lifted, as shown in figure 4.

Equations of motion
So far we find a proliferation of vertices, each particle is associated with a vertex carrying both helicity weight and momentum insertions for massless particles and only spin weight for a massive one. Besides, in the latter case, we need to add a vertex next to the spin vertex of the corresponding particle for each insertion of massive momenta. The order of momentum vertices among themselves is irrelevant, even though it seems crucial when we are dealing with planar graphs only. In this section, we will show how the Dirac equation for the spinors allows mapping our problem to a finite set of fully massless classifications. Then, before dealing with momentum conservation identities, we simplify our problem by using the graph equivalent of the unbolding-bolding procedure presented in [80].

JHEP08(2022)299
In the previous section, we have shown that choosing carefully the arrangement of the momentum vertices in the circular embedding is essential to guarantee that any polynomial structure can be written as a linear combination of structures in our basis which have the same number of explicit mass powers or higher. This suggests that there could be a way to classify independent spinor structures with fixed powers of mass, i.e. a classification modulo equations of motion, excluding all the graphs where any momentum vertex is connected to the corresponding spin vertex. The key observation is the following: unbolded graphs, i.e. graphs for which we do not distinguish between momentum and spin vertices, are in one-to-one correspondence with planar "massive"-bolded graphs for which no momentum vertex is linked to the corresponding spin vertex and between themselves, and the edges are not crossing. An example of this is illustrated in figure 5.
When we deal with massive structures, we have to introduce a notion of transversality, because the spins characterise our structures only partially. Indeed, when we consider, for example, a spin-1 particle, its polarisation tensor (that we define to be dimensionless) could in principle be defined in several ways: which correspond to transversality −1, 0, and +1 in our notation. In general, the transversality can take the values C = −J, −J + 1, . . . , J and we will specify it as J C . The set of transversalities and helicities identify the helicity category of the structure. Any edge, linking a momentum vertex with its respective spin vertex, gives a power of the mass and changes the transversality of the structure: We considered the planar graphs associated terms in the helicity category (1 10 , 2 10 , 3 +1 , 4 −1 ) and mass dimension 6. For simplicity, we did not consider a priori the ones with insertions of p 4 and those proportional to any insertion of M 1 and M 2 . We are showing both the unbolded and the bolded versions of the graphs to make the one-to-one correspondence evident. The two framed graphs correspond to our basis after taking into account momentum conservation. or graphically Indeed, given the valency of the spin vertex of the When we classify the combinations in the helicity category for massive and massless particles, respectively) and mass dimension ∆, the number of momentum insertions is ∆ − n i=1 |S i |. Then, if we are interested in the kinematic basis, in addition to the structures with the chosen transversality and no mass insertion (helicity category basis), we need to consider also the terms in which the equations of motion change the transversality. We consider the example shown in figure 5, i.e. (1 1 0 , 2 1 0 , 3 +1 , 4 −1 ) 6 : we also need to classify (1 1 +1 ,

JHEP08(2022)299
The total power of the masses cannot exceed the number of momentum insertions in the original structure. In particular, the maximum power of the i th -particle mass in the kinematic basis is (3.6)

Momentum conversation
When dealing with massive structures, momentum conservation identities involve more subtleties. First, we can always choose a particle whose momentum does never appear in the structure: for example, the n th -state. Then, we can write the remaining momentum conservation identities as

7)
JHEP08(2022)299 where the LG indices can be either contracted or not, or not be present at all (as the corresponding particle could be massless). We write these identities such that the terms with higher powers of the masses are independent, i.e. they can only be written as a linear combination of the structures with the same or higher mass powers. This allows to effectively set them to zero and work modulo equations of motion ( D ), as explained in the previous section. For example, some of the equations in (3.7) look like which resemble fully massless identities (2.14). Classifying the structures up to equations of motion means that we can put forward the identification and its "conjugate". This is equivalent to stating that the momentum conservation conditions for unbolded graphs are identical to the fully massless case, i.e. that we should not distinguish between spin and momentum vertices but only keep track of the number of momentum insertions for each particle. In particular, if the n th particle is either massless or J n ≤ 1 2 , momentum conservation identities for unbolded graphs are identical to the fully massless case, once we check if there are insertions of p 1 or p n−1 .
On the other hand, there is a subtlety when we consider fully massive structures or, in general, we choose to fully eliminate the momentum of a spin-J massive particle whose transversality C = −J, J and J ≥ 1. In particular, in these cases, the structures n I |p 1 |(n−1) J ] and (n−1) I |p 1 |n J ] are not guaranteed to be planar because the spin vertex of the n th -particle has non-vanishing valency for the edges corresponding to both squares and angles, even if there are no momentum insertions associated to it. Nevertheless, these non-planar structures give additional momentum conservation constraints which should be taken into account.
An ad hoc solution to overcome this problem is the following: JHEP08(2022)299 1) We classify and count the number m of independent structures, or planar graphs after redefining the valencies of the vertices as where l = l 1 + l 2 . In this way, we classify the independent structures for which we factorise the product (n − 1) I 1 |p 1 |n J 1 ] l 1 n J 2 |p 1 |(n − 1) I 2 ] l 2 .
2) If we restore the factorised edges in the graphs obtained in this classification as for i = 1, . . . , m, we obtain a series of planar and non-planar graphs. The structures corresponding to planar graphs in this classification must be removed from our basis.
3) Non-planar structures must be treated separately. There is a unique source of nonplanarity in these graphs and, using iteratively Schouten identities, we can write this non-planar structures as linear combination of planar ones. In particular, we find and its "conjugate". Using momentum conservation on the l.h.s. we can trade p 1 insertions with a sum of structures which do not depend on neither p 1 , p n−1 nor p n . This means that each non-planar structure gives a linear constraint for terms appearing on the r.h.s. .

4) Then
, we can discard a number m of graphs whose adjacency matrices satisfy the conditions or or their "conjugates".
Surprisingly, if we consider cases in which J i ≥ 1 and C i = −J i , J i for i = 1, n − 1, n, there is an additional relation to take into account: In order for the terms in this additional relation to be independent from the momentum conservation conditions already considered, the momenta p 1 , p n−1 , and p n must be massive and none of them can appear in the structures in (3.15). The algorithm to eliminate this additional constraint is identical to the one just presented, except for the factorised structure, which we choose to be 1n [(n − 1)n] (n − 1)|p 2 |1], and the corresponding planar structures that we need to eliminate are shown in figure 6.
These algorithms give the basis of the independent kinematic structures we are looking for, modulo Schouten identities, momentum conservation, and equation of motion. To find the complete kinematic basis we need to consider all the helicity categories bases with lower mass dimensions multiplied by proper mass powers, as shown in section 3.2.

A summary of the algorithm
We now present a summary of the algorithm for minimal amplitudes, including massive particles. The general structure is the same presented for fully massless amplitudes, with few key differences.
1. We start with an initial trivial assignment of vertex valencies determined by the field content of the operators and the distribution of momentum insertions (i.e. mass dimensions).
2. We are interested in the helicity category basis, then we will work up to terms with explicit powers of the masses, i.e. we do not distinguish free spinors and momentum vertices in the graphs.
3. We generate the corresponding structures which are kinematically independent: 10 (a) We classify all the planar graphs. 10 As in the massless case, this classification correspond to the UniformMassStructures function in the MassiveGraphs code. If we are also interested in the terms proportional to powers of the masses, i.e. to the kinematic basis, the function to use is IndependentSpinStructures.

JHEP08(2022)299
(b) From this set of graphs, we exclude some of the graphs thanks to momentum conservation, as explained in section 3.3.
(c) To each of the remaining graphs, we can associate a unique planar massive graph. 11 (d) Using the massive generalisation of the map M, we write down our basis of kinematically independent spinor structures in the helicity category basis.
4. When dealing with identical particles, we also need to decompose some structures which do not appear in our basis. Since our algorithm relies on the unbolding/bolding procedure at the level of graphs, we can find linear relations only up to terms with masses, like equations (3.8), (3.9) or (3.15). The details can be extrapolated from point (4)

Applications
In this section, we are going to present some applications of our method for the classification of irrelevant interactions in effective theories. The fully massless algorithm has already been used in [12] to list the SMEFT irrelevant operators up to dimension eight. The method presented in this paper can be applied to any number of particles with arbitrary helicity and spin. In particular, we will show, as basic applications of our method, the classification of D 2n F 4 effective interactions in SU(N ) Yang-Mills theories, five-point effective interactions involving W , Z and γ vector bosons and spin-tidal interactions in gravity. In particular, in the last case, we will show how our method is related to the strategy presented in [80], explicitly showing the mass-complete relations relevant to the case considered.
We will briefly mention how to treat identical particles and colour structures, which have been extensively studied in the literature [48,50,78,80,87,88]. We will stick to the strategy and the conventions presented in [12].
All algorithms have been implement in the Mathematica package MassiveGraphs, which make use of the SpinorHelicity package. More complicated examples can be solved using these codes.

D 2n F 4 interactions in gauge theories
We consider now a simple example in which all the particles are massless vector bosons in SU(N ) Yang-Mills theory with N > 3. We will consider in order the three independent helicity configurations (+ + ++), (+ + +−) and (+ + −−).

All-plus configuration
The algorithm provides us with a basis of kinematically independent structures which are compatible with the mass dimension 4 + 2n and the chosen helicity configuration. In particular, we find which correspond to the only n+3 graphs that meet all the requirements stated in section 2.
A basis of independent colour structures for N > 3 is where P 3 (2, 3, 4) corresponds to the permutations of (2, 3, 4), and τ A 1 A 2 A 3 A 4 is the trace of four SU(N ) generators τ A . These two bases must be combined to find the effective interactions we are looking for. At this point, we have 9 × (3 + n) terms and, as we are dealing with identical particles, we need to sum over all the permutations of the external legs in these structures. For example, we can consider The structure s n 13 [13] 2 [24] 2 does not belong to our basis and we have to rewrite it as a linear combination of elements of our basis. We can do this using the algorithm presented in section 2 and we always verify such relations on rational kinematics, as presented in appendix B. This means that, after symmetrisation, not all the 9 × (3 + n) structures are kinematically independent. Indeed, it turns out that only 4 + 2 n 2 structures actually are. We are going to present a basis of effective interactions for n ≤ 8, which we will denote by B 4+2n : where and the symmetrisation is understood for each element in the lists. For example, the first element in B 4 is (4.4)

Single-minus configuration
In this case, the basis of kinematically independent structures consists of n elements: After combining with the colour basis and symmetrising over the (1, 2, 3) we end up with 3n+1 2 independent contact terms: where the symmetrisation is understood for each element in the lists.

MHV configuration
In this configuration the basis of kineamatically independent structures consists of n + 1 elements: where the negative powers of the Mandelstam invariants for n = 0, 1 mean that such a structure is not in the basis.

JHEP08(2022)299
The number of effective interactions in the SU(N ) gauge theories is 4 + 7n 2 and the choice of basis is given by Clearly, the basis we found is not the most symmetric and recursive. In this section, we wanted to show how our method can systematically deal with this problem of classification. But it is easy to start from our basis and find more symmetric ones, as we will show explicitly in section 4.3.

Five-point interactions between W , Z and γ
In this section we show how our algorithm can be applied beyond the results of [80] (beyond four-point and purely massive amplitudes), classifying the effective interaction corresponding to dimension-6 operators at five-point, with massive (both charged and uncharged) and U(1) massless vector bosons, which we call W ± , Z and γ. Such operators can appear in various combinations: and F γ Z 4 . Now we will deal with the purely massive cases and the mixed case separately, as the purely kinematic structures are common in the two cases.

Five-point massive effective interactions
First, we need to classify all possible contact terms using the algorithm presented in section 3: we need terms with mass dimension 6 and in the helicity category (1 1 0 , 2 1 0 , 3 1 0 , 4 1 0 , 5 1 0 ), and terms with mass dimension 5 in the various helicity categories (1 1 ±1 , 2 1 0 , 3 1 0 , 4 1 0 , 5 1 0 ), plus the permutations needed to distinguish different particles. We are not going to write all the structures explicitly as they are of order 10 2 . As in the purely massless case, after symmetrising over identical particles we find structures that are not in our basis of kinematic independent structures. Nevertheless, we can use our algorithm to write down explicitly the decomposition of such structures. When doing so, it is important to distinguish between m i , m i , and M i , and only at the very end set m i = m i = M i , as explained in the appendix B.

JHEP08(2022)299
It is important to note that in the massive case, such relations contain terms across different helicity categories, which enter in the relations multiplied by powers of the masses. Then, the linear independence of the symmetrised terms can be checked by either setting all the masses to zero and working with a fixed helicity category, or by keeping the masses and considering the independence across the different categories in order of increasing mass dimension.
The number of independent contact terms in the three cases under consideration All elements of these lists are understood to be properly symmetric under permutations: the elements of the former must be symmetric in (1,2) and (3,4) and the latter in (3,4,5). For example, if we consider the first element of B W 4 Z

JHEP08(2022)299
After the proper symmetrisations, we find that the number of contact terms for the operators we are considering are 1, 3 and 0, respectively. In particular, we find

Spin-tidal interactions in gravitational EFTs
In this section, we will apply our algorithm to classify the operators that encode spin-tidal interactions for spin S i = 1 in gravitational systems. This work has been carried out for S i = 0, 1 2 in [40,43]. In this section, we will massage the original basis such that the terms appearing are easily recursive when going up in mass dimension. Furthermore, we will highlight the difference between our strategy and the existing procedure presented in [80]. We will study the helicity category (1 1 0 , 2 1 0 , 3 +2 , 4 +2 ) in detail and present the general result in table 1 and 2.
The minimal mass dimension for such helicity category is 6, and the basis is with k = 0 are not kinematically independent from those in our basis. In particular, we have the (mass completed) relation: In the strategy of [80], in the helicity categories ( On the other hand, our algorithm regards the two structures in the different helicity category as independent and excludes the terms mentioned above. where the elements of the bases are always understood as properly symmetrised. the implementation of the algorithms, Gauthier Durieux and Yael Shadmi for valuable comments on the algorithm, the code and comparisons with the strategy outlined in [80]. This work was supported by the European Union's Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No. 764850 "SAGEX".
Added note. Shortly after this preprint was posted on the arXiv, reference [89] appeared. The authors presented a different method for the classification of amplitude bases in four dimensions, using Young Tableau techniques, extending and applying the algorithms presented in [84]. This method is built on rigorous group-theoretical statements and is completely general. Their bases are expected to be strictly related to those coming from the algorithms presented in this work, although the precise map needs further investigation.

A The spinor helicity formalism: review and conventions
Most of the work in this paper has been done working in (+ − −−) signature, where the usual four-momenta can be converted to bispinors using Pauli matrices as a realisation of the isomorphism so(1, 3) ∼ sl(2, C): p αα = p µ σ µ αα , pα α = p µσ µαα , where the Pauli matrices are σ µ αα = (1, σ) andσ µαα = (1, − σ). The undotted and dotted indices transform in the fundamental and anti-fundamental representation of the SL(2, C) group. These spinor indices are raised and lowered by the two-dimensional -tensors, such that:

JHEP08(2022)299
For massless and massive momenta, we have where I is an index in the fundamental of SU(2) (massive little group). Uniformly to (A.1), SU (2) indices are raised and lower by -tensor defined such that The two spinors are related by complex conjugation: The Lorentz invariants are defined as where the spinors in this definition can be either massless or massive, in which case we omitted the spinor indices. Spinors satisfy the Dirac equation: where m i = e iα M i and m i = −e −iα M i , with α being a constant real number. This distinction is immaterial and we will set α = 0 at the very end of the calculations, but it is relevant when we evaluate these structures numerically, as explained in detail in appendix B. This is guaranteed is we define m i and m i as

B Momentum twistors and massive (rational) kinematics
To verify that the structures in our basis are kinematically independent and to investigate the independence of the structures upon symmetrisation, we evaluated the polynomial structures over rational kinematics, 12 which allow reconstructing rational functions without loss of precision [90,91]. Indeed, it is widely known that it is possible to generate rational kinematics satisfying both on-shell and momentum conservation conditions [92,93]. This is possible, for example, by analytic continuation to (+ + −−) signature and by generating the kinematics in terms of the momentum twistors variables introduced in [94]. This construction was introduced for fully massless four-dimensional kinematics. The generalisation to the massive case is trivial. The spinor helicity formalism in split signature is formally different from the one introduced in the previous section, but practically the same. The little group for massless JHEP08(2022)299 and massive particles are R and SL(2, R), respectively. Besides m i and m i are two real numbers such that m i m i = M 2 i . Condition (A.4) is lifted, and the dotted and undotted spinors are real and independent of each other.
Introducing spinor helicity variables automatically makes the momenta satisfy onshell conditions, but the momentum conservation identity is a quadratic constraint on our kinematic variables. To make sure that the kinematics stays in the field of rational numbers, we need to rewrite this constraint in terms of linear equations. This is possible in four dimensions expressing the kinematic in terms of momentum-twistor variables. Momenta can be rewritten in terms of dual momentum variables x i : which make momentum conservation between n particles trivial: Then each massless momentum is associated with two null-separated points, and momentum conservation tells us that the set of dual variables forms a polygon. The on-shell condition defines a new variable [µ i |, through the incidence relation Given a (randomly generated) set of pair of spinors Z A i = (λ α i , µ iα ), named momentum twistor variables, such that Z n+1 = Z 1 , and using the incidence relation, we find the spinors λα i through the dual twistor In particular, one can verify that the randomly generated spinors λ α i and their conjugates λα i satisfy λ α i λα i = 0. Planar Mandelstam invariants can be written in terms of twistor variables: This procedure was introduced to generate a fully massless kinematics over the rational or finite fields. However, it can be generalised to the massive case once we decompose massive momenta into a couple of massless ones: where k µ and q µ are two massless momenta such that q i αα kα α i = M 2 i . Then if we are considering a scattering amplitude for n massless and m massive states, we need to randomly generate n + 2m twistor variables: where i = 1, . . . m, j = m + 1, . . . n + m and I = 1, 2. By doing so, the masses are randomly generated as well: (i − 1) 2 i 1 i 2 (i + 1) 1 , (B.8)

JHEP08(2022)299
where Z 2 A 0 = Z A n+m and Z 1 D n+1 = Z D n+1 . However, we might be interested in cases where some states have the same mass, like the examples considered in section 4.2 and 4.3. For example, we can consider l particles with the same mass. In this case, we can generate a bi-twistor associated with one of these particles fully randomly, while for the others we can leave, for example, the component µ 2 i2 undetermined. These are fully fixed by l − 1 linear equations requiring that the masses obtained from equation (B.8) must be equal to the one we generated randomly.

C The reduction the planar basis
In this section, we give details on the algorithm to decompose spinor structures corresponding to a non-planar graph into our basis, given by the set of structures related to planar graphs. Such decomposition amounts to repeatedly applying Schouten identities, which act separately on angle and square invariants. Then for simplicity, we are going to consider Lorentz invariant structures with only angle invariants (S ij = 0 ∀ i, j). The condition that identifies a crossing between the edges (i, j) and (k, l) is Obviously, there are a finite number of edges (and crossings) associated with each vertex. We can consider the total number of crossings of the matrices A and A + E (a,b) (c,d) , which we call n × and n × , respectively. Then, proving that is equivalent to the statement that every non-planar graph can be decomposed as a sum of planar ones in a finite number of steps. We have Summing these contributions, we find The same is true for the difference between the total number of crossings of A and A+F (a,b) (c,d) .

JHEP08(2022)299
Then, we need to choose a recursive way of eliminating all the crossings. We select a, b, c, d so that we have (C.1) and they are the smallest (in the selected order). We apply the decomposition in equation (2.5) min{A ab , A cd } times and we repeat this step until we end up with a sum of planar structures. Obviously, this choice is not always the fastest route, but the decomposition into planar graphs does not require an optimised strategy.
Open Access. This article is distributed under the terms of the Creative Commons Attribution License (CC-BY 4.0), which permits any use, distribution and reproduction in any medium, provided the original author(s) and source are credited. SCOAP 3 supports the goals of the International Year of Basic Sciences for Sustainable Development.