first version of graph loop analysis