Some simple Graph Algorithm