Shortest distance in a graph

Name | Example |
---|---|

When BFS examine the target before pushing, or wait after poping at the next level? | |

What if starting and ending point is the same? | |

Initialize level with 0 or 1? |

Link: Why can’t DFS be used to find shortest paths in unweighted graphs?

See all series problems: #shortestdistance

- LeetCode: Shortest Word Distance III
- LeetCode: Shortest Way to Form String
- LeetCode: Shortest Path with Alternating Colors
- LeetCode: Shortest Path Visiting All Nodes
- LeetCode: Shortest Path in Binary Matrix
- LeetCode: Shortest Distance to Target Color
- LeetCode: Shortest Distance to a Character

See more blog posts.