the original version use adjancency list, momery exceed; this time use adjacency matrix, pass, need to refer other's more elegant code, TODO