A new algorithm to extract the backbone in a random resistor network