The efficiency of the calculation of Green's function (GF) for nano-devices is very important because the calculation is often needed to be repeated countlessly. We present a set of efficient algorithms for the numerical calculation of GF for devices with arbitrary shapes and multi-terminal configurations. These algorithms can be used to calculate the specified blocks related to the transmission, the diagonals needed by the local density of states calculation, and the full matrix of GF, to meet different calculation levels. In addition, the algorithms for the non-equilibrium occupation and current flow are also given. All these algorithms are described using the basic theory of GF, based on a new partition strategy of the computational area. We apply these algorithms to the tight-binding graphene lattice to manifest their stability and efficiency. We also discuss the physics of the calculation results.