Data association is an important problem in simultaneous localization and mapping, however, many single frame based methods only provide suboptimal solutions. In this paper an optimal graph theoretic approach is proposed. We formulate the data association as an integer programming (IP) and then prove that it is equivalent to a minimum weight bipartite perfect matching problem. Therefore, optimally solving the bipartite matching problem implies optimally resolving the IP, i.e. the data association problem. We compare the proposed approach with other widely used data association methods. Experimental results validate the effectiveness and accuracy of the proposed approach, and manifest that this graph based data association method can be used for online application.