"VGL Guide — Example 19: Decision Tree"
Estimated reading time: 1 minutes.
Example 19: Decision Tree
A decision logic graph for a hiring process showing how a series of questions leads to distinct outcomes:
vgraph hiringDecision: DecisionTree "Should We Hire This Candidate?" {
// Opening decision point
node q1: DecisionPoint "Is the candidate technically qualified?";
node c1: Choice "Yes";
node c2: Choice "No";
// Follow-up question for qualified candidates
node q2: DecisionPoint "Does the candidate fit the team culture?";
node c3: Choice "Yes";
node c4: Choice "No";
// Terminal outcomes
node o1: Outcome "Extend offer";
node o2: Outcome "Reject — technical skills insufficient";
node o3: Outcome "Reject — poor cultural fit";
// Branch from first question
edge q1 -> c1: decision_to_choice;
edge q1 -> c2: decision_to_choice;
// Path for unqualified candidate leads directly to outcome
edge c2 -> o2: choice_to_outcome;
// Qualified candidates proceed to culture question
edge c1 -> q2: choice_to_decision;
edge q2 -> c3: decision_to_choice;
edge q2 -> c4: decision_to_choice;
// Final outcomes
edge c3 -> o1: choice_to_outcome;
edge c4 -> o3: choice_to_outcome;
}
Note: Decision Trees flow top-to-bottom. Every DecisionPoint branches into one or more Choice nodes. Each Choice leads either to another DecisionPoint (continuing the logic) or to an Outcome (terminal result). Outcomes have no outgoing edges.
Home