In this paper we continue the study of right-angled Artin groups up to commensurability initiated in [CKZ]. We show that RAAGs defined by different paths of length greater than 3 are not commensurable. We also characterise which RAAGs defined by paths are commensurable to RAAGs defined by trees of diameter 4. More precisely, we show that a RAAG defined by a path of length $n>4$ is commensurable to a RAAG defined by a tree of diameter 4 if and only if $n$ is 2 modulo 4. These results follow from the connection that we establish between the classification of RAAGs up to commensurability and linear integer-programming.