MinimumBandwidthOrdering
MinimumBandwidthOrdering[g]
attempts to find a vertex ordering that minimizes the bandwidth of the undirected graph g.
MinimumBandwidthOrdering[m]
attempts to find row and column permutations that minimize the bandwidth of the matrix m.
更多信息和选项
- To use MinimumBandwidthOrdering, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
- For a graph {V,E} with vertex ordering f, the bandwidth of the graph is defined as Max{u, v}∈E f[u]-f[v].
- For a matrix m=(aij), the bandwidth is defined as Maxaij≠0 i-j.
- For a symmetric matrix, the envelope size is defined as ∑i Max(0,Maxaij≠0i-j), which is the sum of the distance from the first element in each row to the diagonal position.
- MinimumBandwidthOrdering treats input graphs as undirected.
- The following options can be given:
-
Method Automatic method to use RefinementMethod Automatic method used to improve ordering RecursionMethod None recursion method to use
范例
打开所有单元关闭所有单元基本范例 (2)
This numbers the vertices using ordering from VertexList:
This finds the bandwidth of the graph with the given ordering:
This finds a vertex ordering that attempts to minimize the bandwidth:
This renumbers the vertices using the minimum bandwidth ordering:
This finds the bandwidth using the vertex ordering given by MinimumBandwidthOrdering:
This defines a rectangular matrix:
This finds the row and column ordering that attempts to minimize the bandwidth of the matrix:
Plots of the matrix before and after the ordering show a decrease in bandwidth:
Options (1)
Applications (1)
One of the applications of minimum bandwidth ordering is in optimizing cache performance of numerical calculations. For example, in multiplying a sparse matrix with a vector, if the matrix is preordered to minimize the bandwidth, then elements of the vector will not be accessed randomly, thus improving cache performance. Because ordering itself takes time, this improvement in cache performance would be beneficial only if the matrix-vector product operation is to be performed repeatedly many times.
This generates a banded matrix, and then randomly permutes it:
This performs a matrix-vector product 50 times:
This permutes the matrix to minimize the bandwidth and permutes the vector correspondingly:
This shows that the matrix-vector product now takes less time:
This checks that the answer is the same, subject to a permutation:
文本
Wolfram Research (2007),MinimumBandwidthOrdering,Wolfram 语言函数,https://reference.wolfram.com/language/GraphUtilities/ref/MinimumBandwidthOrdering.html.
CMS
Wolfram 语言. 2007. "MinimumBandwidthOrdering." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/GraphUtilities/ref/MinimumBandwidthOrdering.html.
APA
Wolfram 语言. (2007). MinimumBandwidthOrdering. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/GraphUtilities/ref/MinimumBandwidthOrdering.html 年