compass.common.tree.describe_graph#
- describe_graph(graph)[source]#
Questions and branches of a decision-tree graph, for event logs
Prompts are kept as templates (placeholders such as
{text}are left unfilled), so the description stays small and is the same for every document the tree runs on.- Parameters:
graph (
networkx.DiGraph) – Decision-tree graph whose nodes have a “prompt” attribute and whose edges may have a “condition” callable.- Returns:
dict–nodes(each with anidandprompt) andedges(each with asource,target, andcondition), in the order the tree checks them.conditionis the condition function’s name, orNonefor an edge taken when no other condition matches.