Helper¶
pdppy.helper
Helper file contains all necessary helper functions for package. The functions are separated by module in which they are used.
Instances Helper Functions
choose_s_t_requests(k, nodes, seed) |
Choose s, t, and request pairs pseudo-randomly from given nodes. |
random_geo_graph_generator(k[, seed]) |
Generate a random geometric graph with 2 **k* + 2 nodes. |
city_graph_generator(city) |
Generate an OSMnx graph of city. |
Algorithms Helper Functions
christofides_approx(G, source) |
Christofides’ Algorithm: 1.5-factor TSP approximation |
preorder_st_traversal(H, T) |
Conducts a pre-ordered traversal of tree T with an s-t orientation. |
valid_minor(T, node_set) |
Helper function for two_tree_traversal. |
contract_tree(T, node_set) |
Helper function for valid_minor. |
separation_oracle(m, where) |
Helper function for branch_cut_integer_prog and linear_prog. |
construct_tour(H, x_opt[, integer]) |
Construct tour graph from decision variables from optimization. |
Plot Helper Functions
node_labels(dict_requests) |
Create dict of nodes with node labels for plotting request number and type. |
node_marker(H, node) |
Return node_marker for plotting of nodes. |
graph_routes(G, P) |
Find routes and position of nodes for each edge in P. |
plot_routes(G, Groutes) |
Produce overlain plot of G and Groutes with specified style below. |