In order to solve problems of low accuracy, high computation complexity and low assigning success rate of a topological graph existing on a large scale for device assigning, the present invention proposes methods and apparatuses for automatic assigning of devices. According to an aspect of the present invention, by comparing measured distance-related information between each target device and reference devices, and assumed distance-related information between reference devices and target devices corresponding to assigning nodes, and then selecting the target device with smallest difference to correspond to the assigning nodes, the assigning accuracy of devices is largely improved; according to another aspect of the present invention, based on multiple reference devices, by determining multiple target devices at multiple assigning nodes simultaneously with a large safety margin, assigning complexity is decreased; according to yet another aspect of the present invention, by dividing a large topological graph into blocks and assigning and verifying sub-topology blocks, the assigning accuracy of sub-topology blocks is improved, and error dispersion is avoided, so that the whole assigning success rate of the topological graph is increased.