dgl.laplacian_lambda_max

dgl.laplacian_lambda_max(g)[source]

Return the largest eigenvalue of the normalized symmetric Laplacian of a graph.

If the graph is batched from multiple graphs, return the list of the largest eigenvalue for each graph instead.

Parameters

g (DGLGraph) – The input graph, it must be a bi-directed homogeneous graph, i.e., every edge should have an accompanied reverse edge in the graph. The graph can be batched from multiple graphs.

Returns

A list where the i-th item indicates the largest eigenvalue of i-th graph in g.

In the case where the function takes a single graph, it will return a list consisting of a single element.

Return type

list[float]

Examples

>>> import dgl
>>> g = dgl.graph(([0, 1, 2, 3, 4, 0, 1, 2, 3, 4], [1, 2, 3, 4, 0, 4, 0, 1, 2, 3]))
>>> dgl.laplacian_lambda_max(g)
[1.809016994374948]