Generate graph dynamicly