Put the function definition in a file named MinCut.m
which must be in your current matlab path (e.g. your current working directory).
Then you will be able to call the function writing
[MinCutGroupsList, MinCutWeight] = MinCut(yourSourceNodes, yourWeightedGraph);
consider also this answer (Matlab: Calling user defined function).