NetworkX

Previous topic

networkx.spring_layout

Next topic

Exceptions

networkx.spectral_layout

spectral_layout(G, dim=2, weighted=True, scale=1)

Position nodes using the eigenvectors of the graph Laplacian.

Parameters:

G : NetworkX graph

dim : int

Dimension of layout

weighted : boolean

If True, use edge weights in layout

scale : float

Scale factor for positions

Returns:

dict : :

A dictionary of positions keyed by node

Notes

Directed graphs will be considered as unidrected graphs when positioning the nodes.

For larger graphs (>500 nodes) this will use the SciPy sparse eigenvalue solver (ARPACK).

Examples

>>> G=nx.path_graph(4)
>>> pos=nx.spectral_layout(G)