Anyway I think it's great that they have a hybrid codebase. With projects like HipHop and this Haskell backend it looks like they are gradually moving away from PHP as their main language.
"For Facebook Chat, we rolled our own subsystem for logging chat messages (in C++) as well as an epoll-driven web server (in Erlang)"
The only efficient way to implement an undirected graph is as a directed graph with doubled edges.
You want to list friends of Alice. Directed: query all friend(Alice, X). Undirected: query all friend(Alice, X) OR friend(X, Alice). Finding all friend(X, Alice) will be very slow without an index of all friend relationships with Alice in the second position. Storing this is harder than just storing friend(Alice, X) and friend(X, Alice).