Wi-Fi based positioning has great potential for use in indoor environments because Wi-Fi signals are near-ubiquitous in many indoor environments. With a Reference Fingerprint Map (RFM), fingerprint matching can be adopted for positioning. Much assisting information can be adopted for increasing the accuracy of Wi-Fi based positioning. One of the most adopted pieces of assisting information is the Pedestrian Dead Reckoning (PDR) information derived from inertial measurements. This is widely adopted because the inertial measurements can be acquired through a Commercial Off The Shelf (COTS) smartphone. To integrate the information of Wi-Fi fingerprinting and PDR information, many methods have adopted filters, such as Kalman filters and particle filters. A new methodology for integration of Wi-Fi fingerprinting and PDR is proposed using graph optimization in this paper. For the Wi-Fi based fingerprinting part, our method adopts the state-of-art hierarchical structure and the Penalized Logarithmic Gaussian Distance (PLGD) metric. In the integration part, a simple extended Kalman filter (EKF) is first used for integration of Wi-Fi fingerprinting and PDR results. Then, the tracking results are adopted as initial values for the optimization block, where Wi-Fi fingerprinting and PDR results are adopted to form an concentrated cost function (CCF). The CCF can be minimized with the aim of finding the optimal poses of the user with better tracking results. With both real-scenario experiments and simulations, we show that the proposed method performs better than classical Kalman filter based and particle filter based methods with both less average and maximum positioning error. Additionally, the proposed method is more robust to outliers in both Wi-Fi based and PDR based results, which is commonly seen in practical situations.