Generation and robustness of quantum entanglement in spin graphs