Code cleanup: Added function buildGraph - to do initial setup of data structure - moved code from main