From c42c399e788045f8a53e8aad24d47617f22236e6 Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Sun, 13 Oct 2024 18:51:39 +0800 Subject: [PATCH] 1 --- StoryPresent/dag_layout.cpp | 60 +------------------------------------ StoryPresent/dag_layout.h | 9 ------ 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/StoryPresent/dag_layout.cpp b/StoryPresent/dag_layout.cpp index 5e03a29..2d5ad85 100644 --- a/StoryPresent/dag_layout.cpp +++ b/StoryPresent/dag_layout.cpp @@ -464,66 +464,8 @@ void dags::DAGGraph::nodes_sort_with_belows(int curr_layer, const QList>& total_nodes) { -// int layer_index = 0; -// QList> nodes; -// while ((nodes = this->nodes_revise_forward_within_layer(layer_index, total_nodes)).size()) { -// current_nodelist_filling_springs(nodes); -// nodes_sort_with_above(layer_index, total_nodes); -// layer_index++; -// } -//} -//QList> dags::DAGGraph::nodes_revise_forward_within_layer(int layer_index, const QList>& nodes) { -// -// -// -// QList> nodes_within_previous_layer; -// if (layer_index) { -// std::copy_if(nodes.begin(), nodes.end(), std::back_inserter(nodes_within_previous_layer), -// [=](std::shared_ptr n) { return n->layerNumber() == layer_index - 1; }); -// } -// QList> nodes_within_current_layer; -// std::copy_if(nodes.begin(), nodes.end(), std::back_inserter(nodes_within_current_layer), -// [=](std::shared_ptr n) { return n->layerNumber() == layer_index; }); -// -// if (nodes_within_current_layer.size()) { -// QList, int>> items_forwards; -// for (auto node : nodes_within_current_layer) { -// auto forwards = node_revise_via_upstream(nodes_within_previous_layer, node); -// items_forwards.append(std::make_tuple(node, forwards)); -// } -// -// for (auto idx = 0; idx < items_forwards.size(); ++idx) { -// auto curr_item = items_forwards[idx]; -// if (std::get<1>(curr_item) > 2) { -// auto node = std::get<0>(curr_item); -// node->setSortNumber(node->sortNumber().toInt() + std::get<1>(curr_item)); -// } -// } -// } -// -// return nodes_within_current_layer; -//} -//double dags::DAGGraph::node_revise_via_upstream(const QList, double>>& prev_nodes, std::shared_ptr node) { -// auto upstream_nodes = node->getUpstreamNodes(); -// QList lev_rst; -// std::transform(upstream_nodes.begin(), upstream_nodes.end(), -// std::back_inserter(lev_rst), [&](std::shared_ptr upn)->double { -// auto trans_it = std::find_if(prev_nodes.begin(), prev_nodes.end(), -// [&](std::tuple, double> ins) { -// return upn == std::get<0>(ins); -// }); -// if (trans_it != prev_nodes.end()) { -// auto trans_val = (std::get<1>(*trans_it) / std::get<0>(*trans_it)->layerNode()->nextNodes().size()); -// return upn->sortNumber().toDouble() - node->sortNumber().toDouble() + trans_val; -// } -// return upn->sortNumber().toDouble() - node->sortNumber().toDouble(); -// }); -// -// return std::accumulate(lev_rst.begin(), lev_rst.end(), 0.0); -//} void dags::DAGGraph::primitiveGraphLayout() { QList> sort_seqs; @@ -561,7 +503,7 @@ void dags::DAGGraph::backwardsLayoutImpls() { } void dags::DAGGraph::adjustLayoutImpls() { - //this->graph_springs_layout_forward(this->node_with_layout); + } diff --git a/StoryPresent/dag_layout.h b/StoryPresent/dag_layout.h index c4345ef..413a0fd 100644 --- a/StoryPresent/dag_layout.h +++ b/StoryPresent/dag_layout.h @@ -102,15 +102,6 @@ namespace dags { void nodes_sort_with_above(int curr_layer, const QList>& total_nodes); void nodes_sort_with_belows(int curr_layer, const QList>& total_nodes); - //void graph_springs_layout_forward(const QList>& total_nodes); - //QList> nodes_revise_forward_within_layer(int layer_index, const QList>& nodes); - //double node_revise_via_upstream(const QList, double>>& prev_nodes, std::shared_ptr node); - //bool current_nodelist_filling_springs(const QList>& ordered_nodes); - - - //bool node_adjust_inlayer_forward(int curr_layer, const QList>& total_nodes); - //std::pair node_evaluate_with_downstream(std::shared_ptr node, const QList>& total_nodes); - //std::pair node_evaluate_with_upstream(std::shared_ptr node, const QList>& total_nodes); }; }