code: def test_tikhonov_regularization_vs_graph_net():
      """Test one of the extreme cases of Graph-Net.
  
      That is, with l1_ratio = 0 (pure Smooth),
      we compare Graph-Net's performance
      with the analytical solution for Tikhonov Regularization.
      """
      X, y, w, mask, mask_, X_ = _make_data()
  
      # XXX A small dataset here (this test is very lengthy)
      G = get_gradient_matrix(w.size, mask)
      optimal_model = np.dot(
          sp.linalg.pinv(np.dot(X.T, X) + y.size * np.dot(G.T, G)),
          np.dot(X.T, y),
      )
      graph_net = BaseSpaceNet(
          mask=mask_,
          alphas=1.0 * X.shape[0],
          l1_ratios=0.0,
          max_iter=400,
          fit_intercept=False,
          screening_percentile=100.0,
          standardize=False,
          verbose=0,
      )
      graph_net.fit(X_, y.copy())
  
      coef_ = graph_net.coef_[0]
      graph_net_perf = (
          0.5 / y.size * linalg.norm(np.dot(X, coef_) - y) ** 2
          + 0.5 * linalg.norm(np.dot(G, coef_)) ** 2
      )
      optimal_model_perf = (
          0.5 / y.size * linalg.norm(np.dot(X, optimal_model) - y) ** 2
          + 0.5 * linalg.norm(np.dot(G, optimal_model)) ** 2
      )
      assert_almost_equal(graph_net_perf, optimal_model_perf, decimal=1)
  
imports: import numpy
  import pytest
  import scipy
  from nibabel import Nifti1Image
  from numpy.testing import assert_almost_equal
  from scipy import linalg
  from nilearn.decoding._objective_functions import divergence, gradient
  from nilearn.decoding.space_net import BaseSpaceNet
  from nilearn.decoding.space_net_solvers import _graph_net_adjoint_data_function, _graph_net_data_function, _logistic_data_loss_and_spatial_grad, _logistic_data_loss_and_spatial_grad_derivative, _logistic_derivative_lipschitz_constant, _squared_loss_and_spatial_grad, _squared_loss_and_spatial_grad_derivative, _squared_loss_derivative_lipschitz_constant, mfista
  from nilearn.decoding.tests._testing import create_graph_net_simulation_data
  from .test_same_api import to_niimgs
label_desc: Use image node_id 12 for calling a global function with example usage: test_tikhonov_regularization_vs_graph_net() without return types