optiwindnet.crossings ===================== .. py:module:: optiwindnet.crossings Module Contents --------------- .. py:function:: get_interferences_list(Edge: numpy.ndarray, VertexC: numpy.ndarray, fnT: numpy.ndarray | None = None, EPSILON=1e-15) -> list List all crossings between edges in the `Edge` (E×2) numpy array. Coordinates must be provided in the `VertexC` (V×2) array. `Edge` contains indices to VertexC. If `Edge` includes detour nodes (i.e. indices go beyond `VertexC`'s length), `fnT` translation table must be provided. Should be used when edges are not limited to the expanded Delaunay set. .. py:function:: edge_crossings(u: int, v: int, G: networkx.Graph, diagonals: bidict.bidict) -> list[tuple[int, int]] .. py:function:: edgeset_edgeXing_iter(diagonals: bidict.bidict) -> collections.abc.Iterator[list[tuple[int, int]]] Iterator over all edge crossings in an expanded Delaunay edge set `A`. Each crossing is a 2 or 3-tuple of (u, v) edges. Does not include gates. .. py:function:: gateXing_iter(G: networkx.Graph, *, hooks: collections.abc.Iterable | None = None, borders: collections.abc.Iterable | None = None, touch_is_cross: bool = True) -> collections.abc.Iterator[tuple[tuple[int, int], tuple[int, int]]] Iterate over all crossings between gates and edges/borders in G. If `hooks` is `None`, all nodes that are not a root neighbor are considered. Used in constraint generation for ILP model. :param G: Routeset or edgeset (A) to examine. :param hooks: Nodes to check, grouped by root in sub-sequences from root `-R` to `-1`. If `None`, all non-root nodes are checked using `'root'` node attribute. :param borders: Impassable line segments between border vertices. :param touch_is_cross: If `True`, count as crossing a gate going over a node. :Yields: Pair of (edge, gate) that cross (each a 2-tuple of nodes). .. py:function:: validate_routeset(G: networkx.Graph) -> list[tuple[int, int, int, int]] Validate G's tree topology and absence of crossings. Check if the routeset represented by G's edges is topologically sound, repects capacity and has no edge crossings nor branch splitting. :param G: graph to evaluate :returns: list of crossings/splits, G is valid if an empty list is returned Example:: Xings = validate_routeset(G) for u, v, s, t in Xings: if u != v: print(f'{u}–{v} crosses {s}–{t}') else: print(f'detour @ {u} splits {s}–{v}–{t}') .. py:function:: list_edge_crossings(S: networkx.Graph, A: networkx.Graph) -> list[tuple[tuple[int, int], tuple[int, int]]] List edge×edge crossings for the network topology in S. `S` must only use extended Delaunay edges. It will not detect crossings of non-extDelaunay gates or detours. :param S: solution topology :param A: available edges used in creating `S` :returns: list of 2-tuple (crossing) of 2-tuple (edge, ordered)