The docs for HyperGraph.getEdges(EdgeType) say "null if the graph does not accept edges of this type".
However, UndirectedSparseGraph extends AbstractTypedGraph, which will return an empty collection if asked for DIRECTED edges - implying that the graph *can* support directed edges.
I have hit this when writing the following utility method, which you might be interested in
public static <V, E> boolean isUndirected(Graph<V, E> graph) {
Preconditions.checkNotNull(graph);
if (graph instanceof UndirectedGraph) {
return true;
}
if (graph instanceof GraphDecorator) {
GraphDecorator<V, E> decorator = (GraphDecorator<V, E>) graph;
Collection<E> directedEdges = decorator.getEdges(EdgeType.DIRECTED);
if (directedEdges == null || directedEdges.isEmpty()) {
// the latter check is a workaround for this bug report
return true;
}
}
return false;
}