def _count_all_possible_nodes(self) -> int:
        """
        Counts all possible nodes in the graph, including all branches.
        
        Returns:
            The total number of nodes in the graph
        """
        # Start with the nodes directly in the graph
        counted = set()
        to_count = list(self.nodes)
        
        while to_count:
            node = to_count.pop(0)
            if node.id in counted:
                continue
                
            counted.add(node.id)
            
            # If it's a decision node, add its branches to be counted
            if isinstance(node, (DecisionFunc, DecisionLLM)):
                if node.true_branch:
                    if isinstance(node.true_branch, TaskNode):
                        if node.true_branch.id not in counted:
                            to_count.append(node.true_branch)
                    elif isinstance(node.true_branch, TaskChain):
                        for branch_node in node.true_branch.nodes:
                            if branch_node.id not in counted:
                                to_count.append(branch_node)
                
                if node.false_branch:
                    if isinstance(node.false_branch, TaskNode):
                        if node.false_branch.id not in counted:
                            to_count.append(node.false_branch)
                    elif isinstance(node.false_branch, TaskChain):
                        for branch_node in node.false_branch.nodes:
                            if branch_node.id not in counted:
                                to_count.append(branch_node)
        
        # Return the count, minimum of 1 to avoid division by zero
        return max(len(counted), 1)

        Counts all possible nodes in the graph, including all branches.
        
        Returns:
            The total number of nodes in the graph
        
src/upsonic/client/graph.py