I have a very large network with 1000's of edges. Below is a small sample. The N is my label for Node and the number that follows is a unique identifier. I want to make all the edges on either side of the arrow (->) into a string of 6 characters. If the left side of the arrow has just 5 characters, then I want to all insert a 0 to the right of the N. Likewise, if the right side of the arrow has just 5 characters, then I want to all insert a 0 to the right of the N. If both sides of the arrow already have 6 characters then do nothing to that edge. The set edges2 is the outcome I'm trying to reach from starting with edges1. Any assistance is much appreciated!
edges1 = {N1003 -> N1003, N1003 -> N1099, N1003 -> N12059,
N1003 -> N22007, N1003 -> N1025}
edges2 = {N01003 -> N01003, N01003 -> N01099, N01003 -> N12059,
N01003 -> N22007, N01003 -> N01025}
edges1 /. x_Symbol /; (StringTake[ToString[x], 1] == "N" && StringLength[ToString[x]] == 5) :> "N0" <> StringTake[ToString[x], {2, 5}]
$\endgroup$