[firedrake] Accessing adjacency matrix of graph of given mesh

George Ovchinnikov lives9 at gmail.com
Thu Nov 5 13:27:27 GMT 2015


Dear all,

I have a mesh, say

mesh = UnitSquareMesh(size, size)

and a function interpolated on this mesh:

V = FunctionSpace(mesh, "CG", 1)
w = Function(V)
w.interpolate(Expression("1"))

Considering the graph corresponding to the mesh, I want to think about
function w as a function on this graph's vertices and work with the
graph with weighted vertices. But I cannot find any convenient graph's
representation like adjacency matrix. The best I could do it to access
vertices coordinates:

mesh.coordinates.vector().array().reshape((-1, 2))

and probably rebuild a adjacency matrix from it, but this seems like a
very bad way of doing this. Is there a better way to get mesh's
adjacency matrix?

I would like to be able to do conversion both ways:
get adjacency matrix corresponding to the mesh and form k-th element of

w.vector().array()

get vertex index in this adjacency matrix and vice verse from
i-th vertex of mesh's graph adjacency matrix get corresponding index for
w.vector().array()

Sincerely,
George



More information about the firedrake mailing list