In this paper, we discuss the Hamiltonicity of graphs in terms of Wiener index, hyper-Wiener index and Harary index of their quasi-complement or complement. Firstly, we give some sufficient conditions for an balanced bipartite graph with given the minimum degree to be traceable and Hamiltonian, respectively. Secondly, we present some sufficient conditions for a nearly balanced bipartite graph with given the minimum degree to be traceable. Thirdly, we establish some conditions for a graph with given the minimum degree to be traceable and Hamiltonian, respectively. Finally, we provide some conditions for a k-connected graph to be Hamilton-connected and traceable for every vertex, respectively.