Shortest Path Visiting All Nodes

Given an undirected connected graph represented as an adjacency list, where graph[i] lists the nodes adjacent to node i, find the length of the shortest path that visits every node at least once. You may start and end at any node and may revisit nodes.

Examples
Input: [[1,2,3],[0],[0],[0]]
Output: 4
Hints

Shortest Path Visiting All Nodes

Given an undirected connected graph represented as an adjacency list, where `graph[i]` lists the nodes adjacent to node `i`, find the length of the shortest path that visits every node at least once. You may start and end at any node and may revisit nodes.