bandwidth

Contents

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:
gGraph

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.

profilebool (optional, default: False)

If True, the profile is also returned.

wavefrontbool (optional, default: False)

If True, the maximum, mean, and root-mean-square wavefronts are also returned.

Returns:
bandwidthint

The largest distance in the ordering between the endpoints of an edge.

profileint

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.

wavefrontstuple of float

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.

See also

vertex_ordering

Orderings that reduce the bandwidth

treewidth

Upper 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, ..., ...))