The interaction of polysulfides with graphene layers substitutionally modified with heteroatoms is analyzed using first-principles calculations, with the aim of using these structures to prevent polysulfide migration in lithium-sulfur batteries. The heteroatoms considered were B, N, O, F, Al, Si, P, S and Cl. An estimation of the residence time of the polysulfide on the doped surface was made based on transition state theory, with the finding that the most useful candidates may be graphene structures doped with Al or Si atoms.