This commit is contained in:
codeboss 2024-10-05 10:26:07 +08:00
parent 0ba87a2d70
commit b24507a479
2 changed files with 32 additions and 28 deletions

View File

@ -278,6 +278,13 @@ void DAGGraph::graph_layer_nodes_sort(int layer_index, const QList<std::shared_p
} }
} }
this->above_nodes_sort(layer_index, nodes);
this->graph_layer_nodes_sort(layer_index + 1, nodes);
}
}
void dags::DAGGraph::above_nodes_sort(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>>& nodes)
{
// 提取所有已知节点 // 提取所有已知节点
QList<std::shared_ptr<DAGOrderHelper>> sorting_nodes; QList<std::shared_ptr<DAGOrderHelper>> sorting_nodes;
std::copy_if(nodes.begin(), nodes.end(), std::back_inserter(sorting_nodes), std::copy_if(nodes.begin(), nodes.end(), std::back_inserter(sorting_nodes),
@ -304,9 +311,6 @@ void DAGGraph::graph_layer_nodes_sort(int layer_index, const QList<std::shared_p
auto sort_idx = sort_values.indexOf(node->sortNumber()); auto sort_idx = sort_values.indexOf(node->sortNumber());
node->setSortNumber(sort_idx - temp_anchor.second); node->setSortNumber(sort_idx - temp_anchor.second);
} }
this->graph_layer_nodes_sort(layer_index + 1, nodes);
}
} }
void dags::DAGGraph::graphLayout() { void dags::DAGGraph::graphLayout() {

View File

@ -87,6 +87,6 @@ namespace dags {
int node_layering_adj(std::shared_ptr<DAGLayerHelper> inst); int node_layering_adj(std::shared_ptr<DAGLayerHelper> inst);
QList<std::shared_ptr<DAGOrderHelper>> tidy_graph_nodes(); QList<std::shared_ptr<DAGOrderHelper>> tidy_graph_nodes();
void graph_layer_nodes_sort(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>> &nodes); void graph_layer_nodes_sort(int layer_index, const QList<std::shared_ptr<DAGOrderHelper>> &nodes);
// void above_node_sort(int curr_layer, ) void above_nodes_sort(int curr_layer, const QList<std::shared_ptr<DAGOrderHelper>>& total_nodes);
}; };
} }