utils
Utilities for graph manipulation.
graph_laplacian(graph)
Compute the graph Laplacian.
Source code in src/spurt/graph/utils.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
order_points(p)
Order points/nodes/vertices by index.
Given a pair of numbers, return a 2-tuple so the first is lower. The use case is that the pair contains pairs of indices representing undirected links, where (a, b) is the same as (b, a). This ordering, and returning a tuple allows us to comparison with ==.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
array - like[2]
|
Data to be ordered, must be comparable. |
required |
Returns:
| Type | Description |
|---|---|
(int, int) : Ordered 2-tuple.
|
|
Source code in src/spurt/graph/utils.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |