sir, i have checked the same code. Its very good.
But i want to apply the same on ultrasound image. Please tell me how to select the mask and how can i change the mask for a particular image

Here's a usage example:
Consider the graph appearing at
http://upload.wikimedia.org/wikipedia/commons/4/45/Dijksta_Anim.gif
The weights matrix is
W = [Inf,7,9,Inf,Inf,14;7,Inf,10,15,Inf,Inf;9,10,Inf,11,Inf,2;Inf,15,11,Inf,6,Inf;Inf,Inf,Inf,6,Inf,9;14,Inf,2,Inf,9,Inf;];
If we want to find the minimal cut such that vertices 1 and 5 are on the same side of the graph:
[MinCutGroupsList, MinCutWeight] = MinCut([1 5], W)
MinCutGroupsList =
2 3 4 0 0 0
1 5 6 0 0 0
MinCutWeight = 24
meaning that:
- Vertices 2,3,4 are on one side of the cut
- Vertices 1,5,6 are on the other side.
- The sum of weights along the cut is 24.
A few farther notes:
- Zero entries for a missing edges also works.
- The weights matrix must be symmetric. Directed edges are not supported.

Comment only