Python Tarjan solution, O(V+2E), detailed documentation with a youtube tutorial sharing
Use Tarjan, I found this very detail and useful youtube here if you want more detailed explaination: https://www.youtube.com/watch?v=RYaakWv5m6o\n\n\nfrom colle
Use Tarjan, I found this very detail and useful youtube here if you want more detailed explaination: https://www.youtube.com/watch?v=RYaakWv5m6o\n\n```\nfrom collections import defaultdict\nclass Solution:\n    def __init__(self):\n        # init critical connection list \n        self.critical = []\n    def criticalConnections(self, n: int, connections: List[List[int]]) -> List[List[int]]:\n        \n        def dfs(node, parent, index):\n            \'\'\'node: current node to do dfs\n               parent: parent of current node, to avoid repeat searching\n               index: Id of the current node (Tarjan ID)\n               lows as globle variable: a list of \'low\' in Tarjan to discover loops \n               (a list of -1 as default)\n               \n               return low\n            \'\'\'\n            lows[node] = index # first assign low as the same as the index\n            \n            for child in c_dic[node]:\n                \'\'\'for loop for doing dfs\'\'\'\n                if child == parent:\n                    # if child is the same as parent skip\n                    continue\n                elif lows[child] == -1:\n                    # if we havent search this child yet perform a dfs; \n                    # because this is a undirected graph we can just assign the low of current node as same as\n                    # the lowest of the children nodes\n                    lows[node] = min(lows[node], dfs(child, node, index+1))\n                else:\n                    # if we already performed a dfs, we will just calucate the min directly\n                    lows[node] = min(lows[node], lows[child]) \n            # if the low didnt get updated, meaning no loop have been founded, we record the               \n            # critical {parent and current node} pair        \n            if lows[node] == index and node != 0:\n                self.critical.append([parent, node])\n            return lows[node]\n        \n        # initialize \'low\'(lowest index of the node this current node can travel to) in Tarjan \n        # to be -1s (to keep track dfs, can also use \'-inf\', neg number etc )\n        lows = [-1]*n\n        # connection dictionary, with key: value --> node: nodes connected to\n        c_dic = defaultdict(set)\n        for u,v in connections:\n            c_dic[u].add(v)\n            c_dic[v].add(u)\n        # perform dfs\n        dfs(0, -1, 0)\n        \n        return self.critical\n        ```
[]