refactor. add __initGraph(length, default) and remove size attribute
raise ValueError when init graph