Determining whether or not a directed or undirected graph is a tree

后端 未结 3 508
Happy的楠姐
Happy的楠姐 2020-12-30 02:59

I would like to know of a fast algorithm to determine if a directed or undirected graph is a tree.

This post seems to deal with it, but it is not very clear; accordi

3条回答
  •  无人及你
    2020-12-30 03:16

    If an undirected given graph is a tree:

    • the graph is connected
    • the number of edges equals the number of nodes - 1.

提交回复
热议问题