The numbers are connected if the prime representation of them has the same number of primes (can be non-distinct)
Example:
$24=2^3\times3^1$ so there are $3+1=4$ prime factors and $16=2^4$ which has $4$ prime factors so they are connected.
$11=11^1$ so there are $1$ prime factor and $12=2^2\times3^1$ so there are $2+1=3$ prime factors so they are not connected.
I thought it should be nice to include my thinking process:
All the primes are connected to each other. What is the same among the primes?
Oh! They have the same number of factors($2$)!
No, it doesn't applies for some connections.
Each graph is a complete graph.
After a while, I found out the connection between the numbers.