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: clipGraph.m
    path of file: ./repos/matGeom/matGeom/graphs
    
    the code of the file until where you have to start completion: function varargout = clipGraph(nodes, edges, varargin)
%CLIPGRAPH Clip a graph with a rectangular area.
%
%   [N2, E2] = clipGraph(N, E, BOX);
%   [N2, E2, F2] = clipGraph(N, E, F, BOX);
%   N is an array ov vertices, E an array of edges, containing indices of
%   first ans second vertices, and F (optional) is either a matrice or a
%   cell array containing indices of vertices for each face.
%   BOX is either a box given as a matrix: [XMIN XMAX;YMIN YMAX], or a row
%   vector following matlab axis format: [XMIN XMAX YMIN YMAX].
%
%   Example
%     % create a simple graph structure
%     n = [0 60; 40 100; 40 60; 60 40; 100 40; 60 0];
%     e = [1 3; 2 3; 3 4; 4 5; 4 6; 5 6];
%     figure(1); clf; hold on;
%     drawGraph(n, e);
%     axis equal; axis([-10 110 -10 110]);
%     % clip with a box
%     box = [10 90 10 90];
%     drawBox(box, 'k');
%     [n2, e2] = clipGraph(n, e, box);
%     drawGraphEdges(n2, e2, 'color', 'b', 'linewidth', 2);

    
function varargout = clipGraph(nodes, edges, varargin)
%CLIPGRAPH Clip a graph with a rectangular area.
%
%   [N2, E2] = clipGraph(N, E, BOX);
%   [N2, E2, F2] = clipGraph(N, E, F, BOX);
%   N is an array ov vertices, E an array of edges, containing indices of
%   first ans second vertices, and F (optional) is either a matrice or a
%   cell array containing indices of vertices for each face.
%   BOX is either a box given as a matrix: [XMIN XMAX;YMIN YMAX], or a row
%   vector following matlab axis format: [XMIN XMAX YMIN YMAX].
%
%   Example
%     % create a simple graph structure
%     n = [0 60; 40 100; 40 60; 60 40; 100 40; 60 0];
%     e = [1 3; 2 3; 3 4; 4 5; 4 6; 5 6];
%     figure(1); clf; hold on;
%     drawGraph(n, e);
%     axis equal; axis([-10 110 -10 110]);
%     % clip with a box
%     box = [10 90 10 90];
%     drawBox(box, 'k');
%     [n2, e2] = clipGraph(n, e, box);
%     drawGraphEdges(n2, e2, 'color', 'b', 'linewidth', 2);
%     
%   See also 
%     graphs, drawGraph, clipGraphPolygon
%

% ------
% Author: David Legland
% E-mail: david.legland@inrae.fr
% Created: 2007-01-18
% Copyright 2007-2023 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas

%% Format inputs

% extract input arguments
faces = [];
if length(varargin)==1
    box     = varargin{1};
elseif length(varargin)==2
    faces   = varargin{1};
    box     = varargin{2};
else
    error('Wrong number of  arguments in clipGraph');
end