a  toolkit for some graph based algorithm