private static FindAugmentingPath ( Node source ) : bool | ||
source | Node | |
Результат | bool |
private static bool FindAugmentingPath(Node source)
{
foreach (Node dest in source.AdjacentNodes)
{
if (!dest.Visited)
{
dest.Visited = true;
if (dest.Match == null || FindAugmentingPath(dest.Match))
{
//source and dest are matched
source.Match = dest;
dest.Match = source;
return true;
}
}
}
return false;
}