fix some bugs and add anypath function to basic graph.