Counting directed graphs
Sure.  Such a function exists.  You have specified it.  Basically, you order the equivalence classes according first to number of vertices, and second by number of edges.  There are countably many graphs, so countably many equivalence classes, so they can be enumerated.  When you can enumerate them, they can be put into bijective correspondence with $\mathbb{N}$.

This function is computable, by enumerating all graphs with a certain number of vertices and edges.  e.g., for each $n:=1,2,3,\dots$, for each $m:=0,1,2,\dots,n^2$, for each graph containing $n$ vertices and $m$ edges, test whether it is isomorphic to any you have computed before, and use that to enumerate the graphs.  Of course, this will be a particularly inefficient algorithm.

In principle there is no known polynomial-time algorithm for computing graph isomorphism, so I would not expect a polynomial-time algorithm for $f$ (but this is not a proof; and it's still possible there might exist algorithms that are relatively efficient in practice).