The importance of a node in a directed graph can be measured by its PageRank. The PageRank of a node is used in a number of application contexts - including web-page ranking - and can be interpreted as the average portion of time spent at the node by an infinite random walk in the graph. We consider the problem of maximizing the PageRank of a node by selecting some of the edges from a set of edges that are under our control. By applying results from Markov decision theory, we show that an optimal solution to this problem can be found in polynomial time. Our approach provides a linear programming formulation that can then be solved by standard techniques. We also show in the paper that, under the slight modification of the problem for which we are given mutually exclusive pairs of edges, the problem of PageRank optimization becomes NP-hard.