Indira Gandhi was not related to Mahatma Gandhi. As for being elected due to her family name, that was probably true in her first election in 1967, which she almost lost. The next three elections she fought were on her name. She won two, and lost one.

He father, Jawarharlal Nehru, won all his elections. It was due to him that India was the only Asian/African colony to remain a democracy from the time of independence.