Real-world networks are usually sparse and high-dimensional representations that occupy considerable storage space and increase the computational complexity when performing network tasks. Recently, various methods of network representation learning that can effectively learn dense and low-dimensional network representations have been proposed. However, while these methods consider either the global or local structure of the network, the structures are not considered comprehensively. To address this problem, we propose a novel network representation learning method based on random walk with restart (NRL-RWR), which effectively captures the global and local structures of a network by means of an improved random walk with restart strategy. First, the random walk with restart is improved by an attention mechanism that assigns weights to edges by measuring the similarity between nodes. Second, the improved random walk with restart strategy has the ability to obtain the probability distribution of nodes, and always returns to the starting position with a certain probability in the process of walking, so that more global and local structures of the network can be retained. Finally, we construct an objective function based on Kullback–Leibler divergence, and we adopt negative sampling and edge sampling to optimize the objective function and reduce the computational complexity of network representation learning. Experimental results based on six real-world networks show that NRL-RWR outperforms state-of-the-art network representation learning methods in obtaining low-dimensional vector representations of networks.