Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于函数 max_degree 生成所得树点度的问题 #1

Closed
FUNFORTIME opened this issue Jul 4, 2024 · 1 comment
Closed

关于函数 max_degree 生成所得树点度的问题 #1

FUNFORTIME opened this issue Jul 4, 2024 · 1 comment

Comments

@FUNFORTIME
Copy link

对函数

graph max_degree(int n, int k, _Weight weightL = 0, _Weight weightR = 0)

设定度为k时,实际树的度为k+1;基于此函数的

graph binary_tree(int n, _Weight weightL = 0, _Weight weightR = 0)

同样会出现可能生成四叉树的问题,如下为函数原型:

graph binary_tree(int n, _Weight weightL = 0, _Weight weightR = 0) { return max_degree(n, 3, weightL, weightR); }

测试用代码:

gen_data(1, 7, [&](int i, int j){
        testcase_writer io("data/", i, j);
                 graph t = binary_tree(10);
                 graph g=max_degree(10, 2);
                 std::string unweighted_t_str = t.to_string<unweighted_output>();
                 std::string unweighted_g_str = g.to_string<unweighted_output>();
                 io.input_writeln(5);
                 io.input_writeln(unweighted_t_str);
                 io.input_writeln(unweighted_g_str);
    }
    );
@xiezheyuan
Copy link
Owner

你说得对,我这个度数计算的是儿子的数量……不过这个好像无关紧要吧,等到我有空时候fix一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants