From Hardy to Rellich inequalities on graphs