i have a undirected graph and i want to print a cycle with length >=k (given) , can you suggest me a algo ? i dont want any code, snippet. i am hoping for hint and algo for this. thanks. it is guaratned that cycle of length >=k exists.. thanks.
You should keep your visited node in order. You need to keep checking whether the new node you are visiting is already in your visited list. If it is, those nodes between the duplicated nodes and its own node compose a cycle. (Remember that you keep them in order of visiting?). The number of nodes inside a cycle is the length of the cycle.
I didn't say that you could not keep another hash-liked structure as another search type for visited. In other words, if you concern about search time from a queue-liked structure of visited node, you could also have an index (hash-liked) just for checking whether the node has been visited. If so, then you could do the linear search to create a cycle.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...