graph_tool.spectral.adjacency produces error when there are no edges
The code
#!python
from graph_tool.all import *
g = Graph() # also undirected
g.add_vertices(2) # any number
adjacency(g)
produces the error:
#!sh
File "/usr/lib/python2.7/dist-packages/graph_tool/spectral/__init__.py", line 140, in adjacency
V = max(g.num_vertices(), max(i.max() + 1, j.max() + 1))
ValueError: zero-size array to maximum.reduce without identity
From the code it is clear that i and j are empty arrays since there are no edges - this produces that error.
A solution would be to insert some if-clause (maybe after line 133: E = g.num_edges() ...), to exclude this special case and return an easy diagonal matrix of size g.num_vertices().