Currently this packages checks if an igraph graph is a forest by computing it girth and comparing with 0:
https://github.com/mikldk/malan/blob/master/R/igraph.R#L26
if (igraph::girth(x, circle = FALSE)$girth != 0L) stop("x must be a tree (or a forest)")
An upcoming version of igraph will change girth() to return Inf for graphs with no cycles (instead of the current 0). To keep compatibility with both the current and future versions, can you please compare both with Inf and 0?
This new version of igraph will also provide an is_forest() function, which will be slightly different than checking girth(): it will return FALSE for graphs with self-loops or multi-edges (which are ignores by girth()).
Currently this packages checks if an igraph graph is a forest by computing it girth and comparing with 0:
https://github.com/mikldk/malan/blob/master/R/igraph.R#L26
An upcoming version of igraph will change
girth()to returnInffor graphs with no cycles (instead of the current 0). To keep compatibility with both the current and future versions, can you please compare both withInfand0?This new version of igraph will also provide an
is_forest()function, which will be slightly different than checkinggirth(): it will returnFALSEfor graphs with self-loops or multi-edges (which are ignores bygirth()).