Common neighbors

How can I find the number of immediate common neighbors between all the nodes
in a given graph and represent it as a matrix. i have attached the graph.
Please provide some inputs. connectivity11.gz
<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4026036/connectivity11.gz&gt;

m = zeros((g.num_vertices(), g.num_vertices()))

for v in g.vertices():
    nv = set(v.all_neighbours())
    for w in g.vertices():
        nw = set(w.all_neighbours())
        m[v, w] = len(nv.intersection(nw))