Build node tree