reconstruct a graph from a given sequence of stati