validates connections when making a graph