Utils

graph_tiger.utils.curved_edges(G, pos, dist_ratio=0.2, bezier_precision=20, polarity='random')

Internal function to enable Bezier curved edges. Code originally from ‘beyondbeneath’ @ https://github.com/beyondbeneath/bezier-curved-edges-networkx

graph_tiger.utils.get_adjacency_spectrum(graph, k=inf, eigvals_only=False, which='LA', use_gpu=False)

Gets the top k eigenpairs of the adjacency matrix

Parameters
  • graph – undirected NetworkX graph

  • k – number of top k eigenpairs to obtain

  • eigvals_only – get only the eigenvalues i.e., no eigenvectors

  • which – the type of k eigenvectors and eigenvalues to find

Returns

the eigenpair information

graph_tiger.utils.get_laplacian(graph)

Gets the Laplacian matrix in sparse CSR format

Parameters

graph – undirected NetworkX graph

Returns

Scipy sparse Laplacian matrix

graph_tiger.utils.get_laplacian_spectrum(graph, k=inf, which='SM', tol=0.01, eigvals_only=True, use_gpu=False)

Gets the bottom k eigenpairs of the Laplacian matrix

Parameters
  • graph – undirected NetworkX graph

  • k – number of bottom k eigenpairs to obtain

  • which – he type of k eigenvectors and eigenvalues to find

  • tol – the precision at which to stop computing the eigenpairs

  • eigvals_only – get only the eigenvalues i.e., no eigenvectors

Returns

the eigenpair information

graph_tiger.utils.get_sparse_graph(graph)

Returns a sparse adjacency matrix in CSR format

Parameters

graph – undirected NetworkX graph

Returns

Scipy sparse adjacency matrix

graph_tiger.utils.gpu_available()