function accuracy = benchmark(samples, labels_gnd, a, a0, connection_matrix, nbNode, nbSamplePerNode, nbNodePerGroup, nbGroup, nbTestSample, spaceDim, c)
% 
% 
% 

assert(nbNode == size(connection_matrix, 1));
assert(length(labels_gnd) == size(samples, 1));

x_nodes = {};


% For each node, we aggragate the samples from the nodes that are connected
% to this node, and use them in addition to the current node's sample for
% training
% 
%     start = (i-1)*nbSamplePerNode + 1;
%     stop = start + nbSamplePerNode - 1;
    
% For each node
for n=1:nbNode 
    
    %%%
    % Step 1: aggregating the samples
    %%%
    
    % First we add the node samples
    start = (n-1)*nbSamplePerNode + 1;
    stop = start + nbSamplePerNode - 1;
    aggregated_samples = samples(start:stop, :);
    aggregated_labels = labels_gnd(start:stop);
    
    % For all the nodes connected to the node n
    connected_indices = find(connection_matrix(:, n) == 1);
    
    for k=connected_indices
        start = (k-1)*nbSamplePerNode + 1;
        stop = start + nbSamplePerNode - 1;
        aggregated_samples = [aggregated_samples; samples(start:stop, :)];
        aggregated_labels = [aggregated_labels; labels_gnd(start:stop)];
    end
    
    %%%
    % Step 2: training the SVM
    %%%
    
    hyper_plane = node_solver(aggregated_samples, aggregated_labels, c, []);
    
    %%%
    % Step 3: add the hyper_plane to a cell array
    %%%
    
    x_nodes{n} = hyper_plane;
    
    
end

accuracy = classify_samples({x_nodes}, a, a0, nbNode, nbGroup, nbNodePerGroup, nbTestSample, spaceDim);




end