Allow name-a in graph

Task names containing the string `-a` were failing because of an old
assumption. This fixes the problem, and adds tests.