added parameter to read from unweighted graph