Index
DelaunayGraph
Bases: PlanarGraphInterface
Class to hold Delaunay triangulation.
This will be the default class in use in this package. This will also be the only class that will interact with Minimum Cost Flow (MCF) solvers for irregular grids.
Source code in src/spurt/graph/_delaunay.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
__init__(xy, scaling=(1, 1))
Create Delaunay triangulation with given coordinates and scaling.
Source code in src/spurt/graph/_delaunay.py
26 27 28 29 30 31 | |
GraphInterface
Bases: Protocol
Interface to 2D graph objects.
Such objects should provide access to points (nodes or vertices), links (arcs) and cycles (simplices).
Attributes:
| Name | Type | Description |
|---|---|---|
npoints |
int
|
Number of points/ vertices/ nodes. |
points |
ndarray
|
(npoints, 2) array corresponding to locations of the points. |
cycles |
list[list[int]]
|
Each entry in the list represents one cycle in the graph. |
links |
ndarray
|
(nlinks, 2) array. Each row contains indices into the points array. |
Source code in src/spurt/graph/_interface.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
cycles
property
Return cycles/ simplices as (nsimplex, ...).
links
property
Return list of links/ arcs in the graph as (nlinks, 2).
npoints
property
Return number of points in graph.
points
property
Return points/ vertices/ nodes as (npts, 2).
Hop3Graph
Bases: PlanarGraphInterface
Class to hold Hop-3 planar graph.
This will be a useful class for missions like Sentinel-1 with narrow baseline tube and when one wants to restrict the interferogram network based on temporal baseline alone.
Source code in src/spurt/graph/_hop3.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
__init__(npoints)
Create triangulation for N points and 3 hops.
Source code in src/spurt/graph/_hop3.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
PlanarGraphInterface
Bases: GraphInterface, Protocol
Interface to a 2D planar graph.
This provides an additional access to the boundary (convex_hull) of the graph. This class is specifically meant for use with MCF solvers and will provide a common interface for Regular 2D grids and Delaunay triangulations. The following assumptions are made regarding our interface for ease of use with MCF solvers: - The graph is connected. - Every edge is a part of one or two cycles utmost. - The links are always oriented from lower index into the points array to the higher index. - The cycles are all oriented in a single direction - either clockwise or anti-clockwise. - All the cycles returned by the interface are of the same length.
Source code in src/spurt/graph/_interface.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
boundary
property
Return arcs in form of pair of vertices forming outer boundary of graph.
This is only a utility and is not necessarily used in the MCF code. There is no concept of boundary for non-planar graphs.
cycles
property
Return cycles as ndarray as cycles are of same length.
Since all cycles are assumed to be of equal length here, we can use an ndarray to be efficient.
Reg2DGraph
Bases: PlanarGraphInterface
Class to hold 2D regular grid.
This is a utility class to test MCF implementation against other regular 2D grid solvers. We will walk down the rows of the 2D grid to determine the order of points, links and cycles.
Source code in src/spurt/graph/_delaunay.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
boundary
property
Return boundary edges in 2D grid.
points
property
Return points in 2D grid.
Points are returned in row-major order.
__init__(shape)
Create regular 2D graph of given shape.
Source code in src/spurt/graph/_delaunay.py
70 71 72 73 74 75 76 | |
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 | |