From bbcf0921ba59cac9831d880e106b66a98aaf1f67 Mon Sep 17 00:00:00 2001
From: codeboss <2422523675@qq.com>
Date: Thu, 1 Aug 2024 08:57:25 +0800
Subject: [PATCH] update
---
.idea/workspace.xml | 48 +++++++++---------
frame/ContentView.py | 6 +--
graph/directed_acyclic_graph/DAGLayout.py | 24 ++++++++-
.../__pycache__/DAGLayout.cpython-312.pyc | Bin 13378 -> 14233 bytes
4 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 38adec9..6ff9221 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,9 +7,7 @@
-
-
@@ -37,30 +35,30 @@
- {
+ "keyToString": {
+ "Python.CompareViews.executor": "Run",
+ "Python.CompareWindow.executor": "Run",
+ "Python.ContentView.executor": "Run",
+ "Python.DAGGraph (1).executor": "Run",
+ "Python.DAGGraph.executor": "Run",
+ "Python.DAGLayout (1).executor": "Run",
+ "Python.DAGLayout.executor": "Run",
+ "Python.DAGPresent.executor": "Run",
+ "Python.MergeView.executor": "Run",
+ "Python.MileStone.executor": "Run",
+ "Python.NovelManage.executor": "Debug",
+ "Python.ReferView.executor": "Run",
+ "Python.StoryMap.executor": "Run",
+ "Python.ast_load.executor": "Debug",
+ "Python.entry.executor": "Run",
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "git-widget-placeholder": "master",
+ "last_opened_file_path": "D:/Projects/Python/StoryCheckTools",
+ "settings.editor.selected.configurable": "reference.settings.ide.settings.new.ui"
}
-}]]>
+}
diff --git a/frame/ContentView.py b/frame/ContentView.py
index ece389c..8e92d2a 100644
--- a/frame/ContentView.py
+++ b/frame/ContentView.py
@@ -1,12 +1,12 @@
import sys
from typing import Dict, List
-from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QMainWindow
-from PyQt5.QtWidgets import QMenu,QAction
from PyQt5.QtCore import QPoint
+from PyQt5.QtWidgets import QApplication, QMainWindow
+from PyQt5.QtWidgets import QMenu
from graph.DataType import Arrow, Point
-from graph.directed_acyclic_graph.DAGPresent import DAGActiveView, Direction
+from graph.directed_acyclic_graph.DAGPresent import DAGActiveView
from parse.StoryMap import StoryMap, XAST_ParseTool
from parse.ast_load import global_ast_path
diff --git a/graph/directed_acyclic_graph/DAGLayout.py b/graph/directed_acyclic_graph/DAGLayout.py
index e480cbb..a3fca1c 100644
--- a/graph/directed_acyclic_graph/DAGLayout.py
+++ b/graph/directed_acyclic_graph/DAGLayout.py
@@ -178,6 +178,21 @@ class DAGGraph:
return max_remains + 1
+ def __node_layering_adj(self, inst: DAGLayerHelper):
+ if inst.input_count > 1:
+ return inst.layer_v - 1
+
+ if len(inst.next_nodes()) == 0:
+ return inst.layer_v - 1
+
+ layer_number = 2**32
+ for cinst in inst.next_nodes():
+ layer_number = min(layer_number, self.__node_layering_adj(cinst))
+ pass
+
+ inst.layer_v = layer_number
+ return inst.layer_v - 1
+
def __tidy_graph_nodes(self) -> List[DAGOrderHelper]:
nodes_temp: Dict[str, DAGOrderHelper] = {}
@@ -236,7 +251,9 @@ class DAGGraph:
# 计算排序系数
for target_node in target_nodes_within_layer:
prev_sorts = list(map(lambda n:n.sort_number, target_node.get_upstream_nodes()))
- target_node.sort_number = sum(prev_sorts)/len(prev_sorts)
+ if len(prev_sorts) > 0:
+ target_node.sort_number = sum(prev_sorts)/len(prev_sorts)
+ pass
pass
def compare_item(a: DAGOrderHelper):
@@ -277,6 +294,11 @@ class DAGGraph:
self.max_layer_count = max(self.max_layer_count, self.__node_layering(item))
pass
pass
+ for item in sort_seqs:
+ if item.input_count ==0:
+ self.__node_layering_adj(item)
+ pass
+ pass
# 整理数据图节点
rich_nodes = self.__tidy_graph_nodes()
diff --git a/graph/directed_acyclic_graph/__pycache__/DAGLayout.cpython-312.pyc b/graph/directed_acyclic_graph/__pycache__/DAGLayout.cpython-312.pyc
index 5ea70b7d43b8b84143ba8f0f9e968fa3d97ebcad..d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