I noticed that the adjacency matrix is used in several centrality measures implemented in graph-tool.
Is there some way to access this adjacency matrix directly or do I have to write a loop over the edges to
fill an 0 initialized matrix with 1s?

As is stated in the documentation, the internal representation used in
graph-tool is an adjacency list, not an adjacency matrix. An adjacency
matrix would require O(N^2) space, and hence it would be very wasteful
(and slow) for large sparse graphs. The adjacency matrix is referenced
in the centrality documentation purely for convenience of notation.

You can get a copy of the graph as a sparse adjacency matrix via the
function:

I tried to include the code of the adjacency method into my program but it doens’t find libgraph_tool_spectral

I don’t understand the __future__, .., etc. imports, how can I simply add libgraph_tool_spectral to my code so that I can calculate the adjacency matrix?

If you call the function adjacency(g), it will return you the adjacency
matrix of graph g. Isn't that what you want? Why do you want to copy and
past the function's implementation?