duongquanghai08's blog

By duongquanghai08, history, 2 months ago, In English

shortest single cycle in an unweighted graph n<=1e6

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Is it a directed or an undirected graph?

If it's an undirected graph, you can construct a DFS Tree, and every back-edge defines a cycle

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +15 Vote: I do not like it

    Shortest cycle length here $$$= 3$$$, not defined by only one back edge

»
2 months ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

I think this can help you

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

orz dequy hai

»
2 months ago, # |
  Vote: I like it +26 Vote: I do not like it

It can't be solved in better than $$$O(nm)$$$, where $$$m$$$ is the number of edges.

https://en.m.wikipedia.org/wiki/Girth_(graph_theory)#Computation

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

i can help u, ib for the perfect solution