def plans(type): triplets = request.get_json(force=True) graph = Graph(triplets) planner = pipeline_res["train-planner"] all_plans = [ l.replace("[", " [ ").replace("]", " ] ").replace(" ", " ") for l in (graph.exhaustive_plan() if type == "full" else graph.plan_all()).linearizations() ] return jsonify({ "concat": {n: concat_entity(n) for n in graph.nodes}, "linearizations": list( sorted([{ "l": l, "s": planner.score(l) } for l in all_plans], key=lambda p: p["s"], reverse=True)) })
def plan_all(self, g: Graph): return g.exhaustive_plan(force_tree=False).linearizations()
def exhaustive_plan(g: Graph): return g.exhaustive_plan().linearizations()