5
$\begingroup$

I am taking an elementary level set theory, and was doing an exercise. The question is "Is the set of all graphs countable?"

My intuition tells me it is not but I am not sure how I can use Cantor's diagonalization argument to prove it. And I don't even know what other methods can be used here.

P.S A graph means a graph in the sense of Graph Theory.

$\endgroup$
8
  • 5
    $\begingroup$ What is a "graph"? (There are many meanings of the word, so whatever the answer is may turn on exactly what you mean by "graph"; for example, the "graph of a function" is one thing, but a "graph" in the sense of Graph Theory is another). $\endgroup$ Dec 1, 2011 at 20:24
  • 2
    $\begingroup$ @John.Mathew: But why can't you take a discrete graph in any cardinality whatsoever? Do you perhaps mean finite graphs? Or even countable graphs? $\endgroup$
    – Asaf Karagila
    Dec 1, 2011 at 20:35
  • 1
    $\begingroup$ In any event, none of the categories on this problem are right, other than "elementary set theory." Maybe graph theory, but not really much. $\endgroup$ Dec 1, 2011 at 20:35
  • 5
    $\begingroup$ The collection of all graphs (e.g. in ZFC), even all finite graphs, is not even a set. The collection of all isomorphism classes of graphs is still not a set. So you need to be more precise. $\endgroup$ Dec 1, 2011 at 20:51
  • 1
    $\begingroup$ @Qiaochu: While I agree with the strong formalism, I find that often in introductory courses it is a good idea just to mention that some collections are not sets. Of course when writing the question one should be accurate and say that $V\subseteq\mathbb N$ or some other set; also using Scott's trick one can quickly limit themselves into a countable (I'd believe so) collection of all the isomorphism classes of all finite graphs. $\endgroup$
    – Asaf Karagila
    Dec 1, 2011 at 21:17

5 Answers 5

11
$\begingroup$

You still haven't specified the question in a rigorous way. If you are talking about graphs $(V,E)$ with $V$ at most countable and $E\subset V\times V$ then the sketch of the proof is the following. Consider any infinite sequence $(x_k)_{k=1}^n$ of zeros and ones. To this sequence you assign the unique graph with $V = \mathbb N\cup\{0\}$ such that $(0,k)\in E$ iff $x_k =1$.

Since the set of such sequences is uncountable, the set of countable graphs is uncountable as well. The set of all finite graphs is countable though since the set of all graphs with #$V = n$ is finite.

$\endgroup$
8
$\begingroup$

One possible approach via Cantor's diagonalisation argument would be as follows. (We will show that there are uncountably many (undirected) graphs with vertex set $\mathbb{N}$.) Hopefully you have seen that $\mathbb{N} \times \mathbb{N}$ is countable, and subsets of countable sets are countable. Therefore the set $A = \{ (m,n) \in \mathbb{N} \times \mathbb{N} : m < n \}$ is countably infinite. We then take some bijection $f : A \to \mathbb{N}$. (Note that you can actually define such a thing, but that is somewhat unimportant.)

We now assume that there are only countably many graphs with vertex set $\mathbb{N}$, and so we take another bijection $g$ from $\mathbb{N}$ onto this set of graphs. For ease of notation, for every $i \in \mathbb{N}$ we will denote by $E_i$ the edge relation of the graph $g(i)$.

I now define a new graph on $\mathbb{N}$ as follows: The edge relation $E_*$ is defined so that given natural numbers $m < n$ we have that $( m , n ) \in E_*$ iff $( m , n ) \notin E_{f(m,n)}$. Since we have a total list of all graphs on $\mathbb{N}$, then $E_*$ must be $E_j$ for some natural number $j$. Note that if $f^{-1} (j) = (m,n)$ then $(m,n) \in E_*$ iff $(m,n) \notin E_{f(m,n)} = E_j = E_*$: a contradiction!

$\endgroup$
1
  • 1
    $\begingroup$ Note that I could have instead opted to pick a bijection $G$ from $A$ onto the set of all graphs on $\mathbb{N}$. The literal conclusion from the contradiction would be that there is no bijection from $A$ onto this set of graphs, but since $A$ is countably infinite, the actual conclusion would remain the same: that this set of graphs is uncountable. $\endgroup$
    – user642796
    Dec 1, 2011 at 21:05
7
$\begingroup$

The collection of all graphs is not even a set. And there are uncountably many graphs on one vertex.

$\endgroup$
3
  • 2
    $\begingroup$ Can you explain this a bit more? Are you saying this because we can label the vertex with uncountably many labels? If we're talking graphs (no multiple edges, no loops, nondirected), and only counting equivalence classes under isomorphism, there is just one, right, the empty graph? And, with this definition, we'd have countably many finite graphs overall, right? Back to the one vertex case, if we allow loops, there could be countably many, because we could have 0 loops, 1 loop, 2 loops, 3 loops, and so on. Where do uncountably many come from? $\endgroup$
    – GeoffDS
    Dec 2, 2011 at 21:58
  • 3
    $\begingroup$ A graph is a pair consisting of a vertex set, $V$ say, and an edge set $E$, where the elements of $E$ are unordered pairs of vertices. The collection of all possible vertex sets is a proper class, not a set. This is because the vertices can be anything at all, there are uncountably many vertices available and two graphs are equal only if they have the same vertex set and the same edge set. In practice we do not want the number of graphs, but the number of isomorphism classes of graphs. The number of isomorphism classes is countable. $\endgroup$ Dec 3, 2011 at 3:13
  • $\begingroup$ Cool, that makes more sense. Thanks for the help. $\endgroup$
    – GeoffDS
    Dec 3, 2011 at 16:30
4
$\begingroup$

Even if you want the set of all graphs on countable sets up to isomorphism, you can take any subset $S\subset\mathbb N$ and write it ordered as $a_1<a_2...$ then create a graph with cliques of size $\{2+a_1, 2+a_2,..\}$ and the resulting graphs are not isomorphic for distinct $S,S'$.

$\endgroup$
3
$\begingroup$

Each of the existing answers proceeds based on more specific interpretations of the general "set of all graphs."

Consider this more specific version: is the set $G$ of all unweighted graphs on finite sets (each $g \in G$ has a finite set $V$) up to isomorphism a countable set? I'd like to show that this set is countably infinite via a bijection with a subset of all binary strings.

There is a finite number of unweighted isomorphic graphs with $n$ vertices, where $n \in ℕ$. The set of all possible edge permutations of an $n$-vertex graph, then, is $\wp M$, where $M$ is the set of all possible edges on an $n$-vertex graph. Because $|M|= n \times n$, $|\wp\ M| = 2^{n \times n}$, which is the number of unweighted isomorphic graphs with $n$ vertices.

This is finite, but because $n \in ℕ$, we can conclude that $G$ is infinite: $|G| = \sum \limits_{n=1}^ \infty 2^{n \times n}$.

To conclude that our set $G$ is countable, we can construct a bijection with another countable set. Because we're only considering finite graphs we can construct an adjacency matrix to uniquely represent each $g \in G$, which will contain some $n \times n$ permutation of weights 0 (no edge) and 1 (edge). If we catenate the rows of such an adjacency matrix, we get a finite binary string of length $n \times n$ for each $g \in G$.

Let's define $A$ as the set of adjacency strings for each $g \in G$. We know that $G\xrightarrow{\rm 1:1,onto}A$.

Because $A \subset$ the countable set of all finite binary strings, $A$ is countable. Because we've described a bijection between $G$ and $A$, we conclude $G$ is countably infinite.

What if we introduce weighted graphs? If we define a finite set of possible edge weights in graphs in $G$, the bijection holds (e.g. if a graph $g$ can have $w$ weights, we can describe it with a base-$(w+1)$ string).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .