build graph using python