BFS in Graph and BFS in Matrix
2017-03-27 00:06
260 查看
图
Graph
N个点,M条边
M最大是O(N^2)
的级别图上BFS时间复杂度=
O(N + M)
说是O(M)问题也不大,因为M一般都比N大所以最坏情况可能是O(N^2)
矩阵Matrix
R行C列
R*C个点,R*C*2条边(每个点上下左右4条边,每条边被2个点共享)。矩阵中BFS时间复杂度=
O(R * C)
Graph
N个点,M条边
M最大是O(N^2)
的级别图上BFS时间复杂度=
O(N + M)
说是O(M)问题也不大,因为M一般都比N大所以最坏情况可能是O(N^2)
矩阵Matrix
R行C列
R*C个点,R*C*2条边(每个点上下左右4条边,每条边被2个点共享)。矩阵中BFS时间复杂度=
O(R * C)
相关文章推荐
- Matrix and linear algebra in F#, Part III: Eigen decomposition and face recognition[z]
- Matrix and linear algebra in F#, Part IV: profile your program, find the bottleneck and speed it up: using matrix multiplication as an example[z]
- algorithm@ find the shortest path in a graph using BFS
- 2017 ACM-ICPC南宁网络赛: J. Minimum Distance in a Star Graph(BFS)
- 2017 icpc 南宁赛区 J. Minimum Distance in a Star Graph(bfs)
- What is the difference between SVD and matrix factorization in context of recommendation engine?
- Matrix and linear algebra in F#, Part I: the F# Matrix type[z]
- Graph Cut and Its Application in Computer Vision
- Graph Visualization and Navigation in Information Visualization: A Survey 译文
- [每日练习] write a function to find the key in a m*n matrix, where each line and column is incremental
- The Idea of Combining Random Matrix and Graphical Models in Machine Learning
- The history of Graph Store(matrix, adjacency list, and orthogonal list)
- Clone Graph leetcode java(DFS and BFS 基础)
- Leetcode: Graph Valid Tree && Summary: Detect cycle in directed graph and undirected graph
- 基本图论定义与术语(Basic Definition and Glossary in Graph The)
- Matrix and linear algebra in F#, Part V: Sparse matrix implementation in PowerPack, and PInvoke a large scale SVD library as an application[z]
- Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
- Graph Cut and Its Application in Computer Vision
- search in 2d matrix and serach minimum in rotated array
- 74. Search a 2D Matrix (Graph; Divide-and-Conquer)