Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure DFS(Now: Integer; Path: TArr; Step: Integer; Child: Byte; LengthPath: Integer; Visited: TArr);
- var
- Turn: Array[1..20] of Integer;
- i, Size: Integer;
- begin
- if Visited[Now] = 1 then
- else
- begin
- Visited[Now] := 1;
- Path[Step] := Now;
- if Childs[Now] <> Child then
- if MaxPath < LengthPath then
- begin
- MaxPath := LengthPath;
- for i := 1 to LengthPath do
- AnsArr[i] := Path[i];
- end;
- for i := 1 to 20 do
- if Matrix[Now, i] = 1 then
- DFS(i, Path, Step + 1, Child, LengthPath + 1, Visited);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement