[Math] Find All NonIsomorphic Undirected Graphs with Four Vertices

graph theory

The Full Question

Find all(loop-free) non-isomorphic, undirected graphs with four vertices. How many of these graphs are connected?

My Work(Ideas)

I'm a little infuriated at this question because it is supposed to be easy, but I can't seem to crack it. I suppose we must have 4 vertices, so I could go through all graphs with zero edges, 1 edges, 2 edges, 3 edges, etc. This seems like it might go on for a long time(i.e. the rest of my natural life). I suppose we may reach a point where all I can make is loops if I add more edges?(I have no idea where this would be) Could anyone maybe offer me a helping hand with this question? I'm fairly confused

Best Answer

There aren’t all that many, and yes, you can go through the possibilities from $0$ edges through $\binom42=6$, the maximum possible. I’ll get you started.

$0$ edges: $1$ graph:

       *   *   *   *

$1$ edge: $1$ graph:

       *---*   *   *

$2$ edges: $2$ graphs, because the edges can be disjoint or share a vertex:

       *---*   *---*                     *---*---*   *

$3$ edges: The edges can’t all be disjoint: that would require $6$ vertices. Thus, we must have

       *---*---*

as part of any such graph. There are $3$ possibilities:

       *---*---*---*                  *---*---*                *---*   *  
                                          |                     \ /  
                                          *                      *

Can you see why no two of these are isomorphic, and why they are the only possibilities?

I’ll leave the rest to you for now. There are very few non-isomorphic possibilities for $6$ edges and for $5$ edges, so perhaps you should start with those cases. The only case that should take a bit of work is the case of $4$ edges.