This commit is contained in:
parent
b57ca6e57e
commit
061fafd728
|
@ -283,39 +283,7 @@ void DAGGraph::graph_layer_nodes_sort_forward(int layer_index, const QList<std::
|
|||
this->graph_layer_nodes_sort_forward(layer_index + 1, nodes);
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool dags::DAGGraph::current_layer_filling_indi(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& nodes)
|
||||
{
|
||||
// ÌáÈ¡±¾²ã´Î½Úµã
|
||||
QList<std::shared_ptr<DAGOrderHelper>> nodes_within_current_layer;
|
||||
std::copy_if(nodes.begin(), nodes.end(), std::back_inserter(nodes_within_current_layer),
|
||||
[=](std::shared_ptr<DAGOrderHelper> ins) { return ins->layerNumber() == layer_index; });
|
||||
if (!nodes_within_current_layer.size())
|
||||
return false;
|
||||
|
||||
std::sort(nodes_within_current_layer.begin(), nodes_within_current_layer.end(),
|
||||
[](std::shared_ptr<DAGOrderHelper>a, std::shared_ptr<DAGOrderHelper> b)->bool {
|
||||
auto prevs_a = a->getUpstreamNodes();
|
||||
auto prevs_b = b->getUpstreamNodes();
|
||||
|
||||
if (!prevs_a.size() && !prevs_b.size())
|
||||
return a > b;
|
||||
if (!prevs_a.size())
|
||||
return true;
|
||||
if (!prevs_b.size())
|
||||
return false;
|
||||
|
||||
auto upnode_a = std::min_element(prevs_a.begin(), prevs_a.end(),
|
||||
[](std::shared_ptr<DAGOrderHelper> a, std::shared_ptr<DAGOrderHelper> b) { return a->sortNumber() < b->sortNumber(); });
|
||||
auto upnode_b = std::min_element(prevs_b.begin(), prevs_b.end(),
|
||||
[](std::shared_ptr<DAGOrderHelper> a, std::shared_ptr<DAGOrderHelper> b) { return a->sortNumber() < b->sortNumber(); });
|
||||
|
||||
return (*upnode_a)->sortNumber() < (*upnode_b)->sortNumber();
|
||||
});
|
||||
|
||||
this->current_nodelist_filling_indi(nodes_within_current_layer);
|
||||
}
|
||||
*/
|
||||
bool dags::DAGGraph::current_nodelist_filling_indi(const QList<std::shared_ptr<DAGOrderHelper>>& nodes_within_current_layer)
|
||||
{
|
||||
// 提取节点划分档次
|
||||
|
@ -386,11 +354,6 @@ void dags::DAGGraph::nodes_sort_with_above(int layer_index, const QList<std::sha
|
|||
auto sort_idx = sort_values.indexOf(node_sortv);
|
||||
node->setSortNumber(sort_idx - temp_anchor.second);
|
||||
}
|
||||
|
||||
//for (auto n : sorting_nodes) {
|
||||
// qDebug() << n->layerNumber() << n->sortNumber().toDouble();
|
||||
//}
|
||||
//qDebug() << "==============================";
|
||||
}
|
||||
|
||||
void dags::DAGGraph::graph_adjust_after_layout(const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes)
|
||||
|
@ -507,15 +470,10 @@ void dags::DAGGraph::node_adjust_ingraph_forward(const QList<std::shared_ptr<DAG
|
|||
{
|
||||
int layer_index = 0;
|
||||
while (this->node_adjust_inlayer_forward(layer_index, total_nodes)) {
|
||||
this->sort_index_partition_indi(layer_index, total_nodes);
|
||||
this->node_adjust_inlayer_partition_indi(layer_index, total_nodes);
|
||||
this->nodes_sort_with_above(layer_index, total_nodes);
|
||||
layer_index++;
|
||||
}
|
||||
|
||||
//for (auto idx = 0; idx < layer_index; ++idx) {
|
||||
// this->sort_index_partition_indi(idx, total_nodes);
|
||||
// this->nodes_sort_with_above(idx, total_nodes);
|
||||
//}
|
||||
}
|
||||
|
||||
bool dags::DAGGraph::node_adjust_inlayer_forward(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes)
|
||||
|
@ -564,18 +522,6 @@ bool dags::DAGGraph::node_adjust_inlayer_forward(int curr_layer, const QList<std
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
//if (std::get<1>(a) == std::get<1>(b)) {
|
||||
// if (std::get<2>(a) == std::get<2>(b)) {
|
||||
// if (std::get<3>(a) == std::get<3>(b)) {
|
||||
// return std::get<4>(a) < std::get<4>(b);
|
||||
// }
|
||||
// return std::get<3>(a) < std::get<3>(b);
|
||||
// }
|
||||
// return std::get<2>(a) < std::get<2>(b);
|
||||
//}
|
||||
|
||||
//return std::get<1>(a) < std::get<1>(b);
|
||||
});
|
||||
|
||||
QList<int> sort_values;
|
||||
|
@ -591,7 +537,7 @@ bool dags::DAGGraph::node_adjust_inlayer_forward(int curr_layer, const QList<std
|
|||
return true;
|
||||
}
|
||||
|
||||
bool dags::DAGGraph::sort_index_partition_indi(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes)
|
||||
bool dags::DAGGraph::node_adjust_inlayer_partition_indi(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes)
|
||||
{
|
||||
// 提取层次节点并排序节点
|
||||
QList<std::shared_ptr<DAGOrderHelper>> nodes_within_current_layer;
|
||||
|
|
|
@ -96,14 +96,13 @@ namespace dags {
|
|||
QList<std::shared_ptr<DAGOrderHelper>> layer_adjust_via_next_sibling(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
void node_adjust_via_next_sibling(std::shared_ptr<DAGOrderHelper> curr_node, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
|
||||
//bool current_layer_filling_indi(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
bool current_nodelist_filling_indi(const QList<std::shared_ptr<DAGOrderHelper>>& ordered_nodes);
|
||||
void nodes_sort_with_above(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
void nodes_sort_with_belows(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
|
||||
void node_adjust_ingraph_forward(const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
bool node_adjust_inlayer_forward(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
bool sort_index_partition_indi(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
bool node_adjust_inlayer_partition_indi(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
|
||||
/**
|
||||
* .
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue