bandwidth#
- graph_tool.structure.bandwidth(g, order=None, profile=False, wavefront=False)[git][source]#
Return the bandwidth of the adjacency matrix with the given vertex ordering.
- Parameters:
- g
Graph Graph to be used.
- orderiterable of
int(optional, default:None) The vertices in their order. If not given, the order of the vertex indices is used.
- profile
bool(optional, default:False) If
True, the profile is also returned.- wavefront
bool(optional, default:False) If
True, the maximum, mean, and root-mean-square wavefronts are also returned.
- g
- Returns:
- bandwidth
int The largest distance in the ordering between the endpoints of an edge.
- profile
int The sum, over the vertices \(v\), of the distance in the ordering from \(v\) back to its first neighbor (or to itself). Only returned if
profile == True.- wavefronts
tupleoffloat The maximum, mean, and root-mean-square, over the positions \(i\) of the ordering, of the wavefront: the number of vertices at positions \(j \ge i\) that are equal to the vertex at \(i\) or adjacent to a vertex at a position \(\le i\). Only returned if
wavefront == True.
- bandwidth
See also
vertex_orderingOrderings that reduce the bandwidth
treewidthUpper bound on the treewidth
Notes
The bandwidth returned is that of the given ordering, and its minimum over all orderings is the bandwidth of the graph. The wavefront is the size of the active front of a frontal solver of sparse linear systems, which is reduced by Sloan’s ordering (see
vertex_ordering()), as defined in the Boost Graph Library. The algorithm runs in time \(O(V + E)\).Examples
>>> g = gt.lattice([10, 10]) >>> print(gt.bandwidth(g, profile=True)) (10, 909) >>> print(gt.bandwidth(g, wavefront=True)) (10, (11.0, ..., ...))