Suggesting updates on the doc of `sklearn.cluster.SpectralClustering`

### Describe the issue linked to the documentation

Hi,

We discover an inconsistency issue between documentation and code in the class [`sklearn.cluster.SpectralClustering`](https://scikit-learn.org/dev/modules/generated/sklearn.cluster.SpectralClustering.html#sklearn-cluster-spectralclustering). As mentioned in the description of parameter `gamma`:

> **gamma: float, default=10**
Kernel coefficient for rbf, poly, sigmoid, laplacian and chi2 kernels. Ignored for _**affinity='nearest_neighbors'.**_

The most relevant piece of source code looks like this:
```
if self.affinity == "nearest_neighbors":
    connectivity = kneighbors_graph(
        X, n_neighbors=self.n_neighbors, include_self=True, n_jobs=self.n_jobs
    )
    self.affinity_matrix_ = 0.5 * (connectivity + connectivity.T)
elif self.affinity == "precomputed_nearest_neighbors":
    estimator = NearestNeighbors(
        n_neighbors=self.n_neighbors, n_jobs=self.n_jobs, metric="precomputed"
    ).fit(X)
    connectivity = estimator.kneighbors_graph(X=X, mode="connectivity")
    self.affinity_matrix_ = 0.5 * (connectivity + connectivity.T)
elif self.affinity == "precomputed":
    self.affinity_matrix_ = X
else:
    params = self.kernel_params
    if params is None:
        params = {}
    if not callable(self.affinity):
        params["gamma"] = self.gamma
        params["degree"] = self.degree
        params["coef0"] = self.coef0
    self.affinity_matrix_ = pairwise_kernels(
        X, metric=self.affinity, filter_params=True, **params
    )
```
It seems that `gamma` will be ignored not only when `affinity` is nearest_neighbors but also when `affinity` is nearest_neighbors, precomputed.

Could you please check it?



### Suggest a potential alternative/fix

Maybe you can reconstruct the if-elif-else statement to cover the situation or update the doc to make it clear.

COMMENT:
Hi @ogrisel @StefanieSenger ,
Thank you for your patience and for providing feedback on our recent bug reports. We are software engineering researchers working on automated program analysis techniques to improve API documentation quality, ultimately contributing to improving data science software development practices. Our tool is currently under development, and in our commitment to transparency, we plan to make it open source upon completion, along with making our research paper available as a pre-print.

We apologize for the extra workload our mistakenly reported issues have caused. We hope to clarify that we have inspected each issue carefully before submitting a bug report. However, our limited familiarity with the codebase has led us to identify what turned out to be false positives. We take full responsibility for these oversights. In response, we are committed to conducting a more thorough review of our findings before submission. 

The constructive feedback from your team has been invaluable in helping us refine our methods. As we move forward, we are committed to enhancing our approach to ensure our contributions are both meaningful and precise, in line with the community's standards and expectations. Thank you for your understanding and for the critical role you play in the developer community. We look forward to the opportunity to contribute positively to your project and the broader data science ecosystem.

Labels: Documentation, Needs Triage