You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: plot_knn.m
    path of file: ./repos/scGEAToolbox/+run/thirdparty/k-NN-code
    
    the code of the file until where you have to start completion: function [Graph] = plot_knn(X, kneighbors)

% Plot k-NN graph (2D or 3D)
%
% Written by (c)Jose Costa (jcosta@umich.edu), version 1.0, 2004


plot_graph_option = 1;

[dim, N] = size(X);


rrw = X(:);
[~, Graph] = kNNgraphmex(rrw, N, dim, kneighbors, 1);

Graph = reshape(Graph, kneighbors+1, N);

rr = X';


mark = 'o';
lwidth = 1;
marksize = 2.5;
markfacecol = 'r';
markedgecol = 'k';
lcol = '-r';

C = {mark, ...

    
function [Graph] = plot_knn(X, kneighbors)

% Plot k-NN graph (2D or 3D)
%
% Written by (c)Jose Costa (jcosta@umich.edu), version 1.0, 2004


plot_graph_option = 1;

[dim, N] = size(X);


rrw = X(:);
[~, Graph] = kNNgraphmex(rrw, N, dim, kneighbors, 1);

Graph = reshape(Graph, kneighbors+1, N);

rr = X';


mark = 'o';
lwidth = 1;
marksize = 2.5;
markfacecol = 'r';
markedgecol = 'k';
lcol = '-r';

C = {mark, ...
    'markersize', marksize, ...
    'markerfacecolor', markfacecol, ...
    'markeredgecolor', markedgecol};
%C2={'-r','linewidth',lwidth};

if plot_graph_option == 1 && dim == 2
    %    figure
    hold on
    for i = 1:size(Graph, 2)
        for j = 1:size(Graph, 1)
            line(rr([i, Graph(j, i)], 1), rr([i, Graph(j, i)], 2))
        end