optiwindnet.pathfinding

Module Contents

class optiwindnet.pathfinding.PathFinder(: networkx.Graph, planar: networkx.PlanarEmbedding, A: networkx.Graph | None = None, branched: bool = True, iterations_limit: int = 15000, traversals_limit: int = 2, promising_margin: float = 0.1, bad_streak_limit: int = 9)[source]

Router for gates that don’t belong to the PlanarEmbedding of the graph. Initialize it with a detour-free routeset G and it will find paths from all nodes to the nearest root without crossing any used edges.

Only edges in graph attribute ‘tentative’ or, lacking that, edges with the attribute ‘kind’ == ‘tentative’ are checked for crossings.

These paths can be used to replace the existing gates that cross other edges by gate paths with detours.

Example:

H = PathFinder(G, planar=P, A=A).create_detours()

iterations = 0[source]
ST[source]
fnT[source]
d2roots[source]
d2rootsRank = None[source]
predetour_length[source]
branched = True[source]
traversals_limit = 2[source]
promising_margin = 0.1[source]
bad_streak_limit = 9[source]
num_revisits = 0[source]
adv_counter = 0[source]
get_best_path(n: int)[source]

_.get_best_path(«node») produces a tuple(path, dists). path contains a sequence of nodes from the original networx.Graph G, from «node» to the closest root. dists contains the lengths of the segments defined by paths.

best_paths_overlay() networkx.Graph[source]

Merges the shortest paths for all nodes with G.

The output includes G’s edges, excluding its gates.

Returns:

Merged graph (pass to plotting.gplot() or ‘svg.svgplot()`).

scaffolded() networkx.Graph[source]

Wrapper for interarraylib.scaffolded.

create_detours() networkx.Graph[source]

Reroute all gate edges in G with crossings using detour paths.

Returns:

New networkx.Graph (shallow copy of G, with detours).