Who am I to say if they could or should visit the shrine. I am no Japanese expert here and I'm certainly not going to judge them if they do. This decision is between them and the people who they are wishing to represent. Nobody else should stand in the way.
Yes, Japanese politicians should visit the Yasukuni shrine, because the shrine is an important part of Japanese history. The shrine is important to the Japanese as a way to honor those who have suffered and died in a large number of conflicts over the years. It is important to the Japanese people that their politicians take part in honoring these people.
Both Germany and Japan committed atrocious war crimes during World War 2 with things like the Holocaust and the Rape of Nanjing respectively. This would be like if Germany created a memorial that honored all German soldiers including SS and convicted war criminals and Angelina Merkel decided to visit it and pay respects. The international backlash against something like this would be overwhelming, but this is not the case with Japan.