to judge whether a given sequence is graphic or not