Insert graph structure in database.