Relative capacity and dimension of graphs