The invention discloses a WiFi seamless switching method based on a neighbor graph algorithm. The method comprises the steps of building a neighbor graph, selecting a target AP through two-stage decision making, and switching to the target AP, wherein information in the neighbor graph mainly comprises an AP mark, the AP position, a working channel, BSSID, a load, the maximum flow and the Qos level, the first-stage decision making greatly shortens time needed by scanning, and the second-stage decision making is used for selecting the target AP; after the AP is selected, adopting a resource restoring mode for rapid switching. Due to the fact that existing information in the neighbor graph is utilized in the scanning process, the number of scanning channels is decreased, the time for scanning each channel is shortened, and the scanning speed is greatly increased; meanwhile, due to the fact that the number of detection response frames is decreased, the bandwidth needed by scanning is decreased, and the method has a great help to improve the network performance; in addition, the method is tightly combined with an existing 802.11r protocol, and the method is easy to deploy and implement.