# No circle in a tree
g <- graph.tree(1000, 3)
girth(g)
# The worst case running time is for a ring
g <- graph.ring(100)
girth(g)
# What about a random graph?
g <- erdos.renyi.game(1000, 1/1000)
girth(g)
Run the code above in your browser using DataCamp Workspace