Graph utility API documentation¶
adjacency_to_laplacian ¶
adjacency_to_laplacian(W)
Convert an adjacency matrix into the graph Laplacian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
W
|
Tensor
|
Batch of normalized graph adjacency matricies. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Batch of graph Laplacians. |
Source code in gsxform/graph.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
normalize_adjacency ¶
normalize_adjacency(W)
Normalize an adjacency matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
W
|
Tensor
|
Batch of adjacency matricies. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Batch of normalized adjacency matricies. |
Source code in gsxform/graph.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
normalize_laplacian ¶
normalize_laplacian(L)
Normalize an graph Laplacian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
L
|
Tensor
|
Batch of graph Laplacians. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Batch of normalized graph Laplacians. |
Source code in gsxform/graph.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
lazy_diffusion ¶
lazy_diffusion(W)
Build the lazy diffusion operator T = 1/2 (I+A).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
W
|
Tensor
|
Batch of adjacency matricies. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Batch of lazy diffusion operators. |
Source code in gsxform/graph.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
compute_spectra ¶
compute_spectra(W)
Compute the spectra of graph Laplacian from its adjacency matrix.
Performs an eigendecomposition (w/o assuming additional structure)
using torch.linalg.eigh (previously used torch.symeig) on a normalized
graph laplacian. Converts from the adjacency matrix to the laplacian
internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
W
|
Tensor
|
Batch of graph adjacency matricies. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[Tensor, Tensor]
|
Batch of eigenvalues and eigenvectors of the graph Laplacian. |
Source code in gsxform/graph.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |