Library for graph algorithm