Refactoring (#4146)

This commit is contained in:
Ishan Makadia
2023-04-14 05:34:47 -03:00
committed by GitHub
parent d241fafd64
commit 0c618b5ee8
3 changed files with 26 additions and 22 deletions

View File

@ -47,7 +47,8 @@ public class HamiltonianCycle {
* @returns true if path is found false otherwise
*/
public boolean isPathFound(int vertex) {
if (this.graph[vertex][0] == 1 && this.pathCount == this.V) {
boolean isLastVertexConnectedToStart = this.graph[vertex][0] == 1 && this.pathCount == this.V;
if (isLastVertexConnectedToStart) {
return true;
}