MathTop

graph_is_forest 函数

判断每个连通分量是否都无环。

语法

  • GraphTheory:-IsForest(edges)
  • graph_is_forest(edges)

参数与选项

edges形如 [[u, v], ...] 的边列表。

示例

  1. 森林判断GraphTheory:-IsForest([[a, b], [c, d]])返回 true。