# Should an Undirected Graph and a Directed Graph with the same vertices and edges have the same number of connected components?

I wrote a Java program that builds a graph from an input txt file. The file just has a list of integer pairs constituting an edge between the two vertices (indicated by the two integers). In the Undirected implementation both vertices are marked as having an edge to each other, while in the Directed implementation the first is marked as having an edge to the second.

Everything else seems to line up, but when I calculate the number of connected components using the same input file, but the two implementations, I am getting two results for the number of connected components (specifically the Directed Graph always comes up with more). Intuitively this doesn't make sense to me, since a connected component is just a grouping of connected vertices, it shouldn't matter if those connections are directed or not.

$$\bullet\longleftrightarrow\bullet\longleftrightarrow\bullet$$
$$\bullet\longleftarrow\bullet\longleftarrow\bullet$$