gh-35512: Improve PolynomialSequence.connection_graph() implementation
Simplify the code; also, the previous code has to iterate over variables
of the sequence twice (this is really bad before #35510).
This affects mainly the method `connected_components()`.
EDIT:
Moreover, now we add a clique between the variables of each polynomial,
so it agrees with the description (the code before used to add just a
spanning tree of the clique -- a star).
This makes this method a little bit slower for the purposes of
`connected_components()` (for which adding a star is equivalent).
However, #35518 will rewrite `connected_components()` without using
`connection_graph()` so this is not really a problem.
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] New tests added to check that a clique is added for the variables
in each polynomial.
### Dependencies
- #35511
URL: https://github.com/sagemath/sage/pull/35512
Reported by: Gonzalo TornarĂa
Reviewer(s): David Coudert, Gonzalo TornarĂa, Vincent Delecroix