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 5ea70b7..dbea7a6 100644
Binary files a/graph/directed_acyclic_graph/__pycache__/DAGLayout.cpython-312.pyc and b/graph/directed_acyclic_graph/__pycache__/DAGLayout.cpython-312.pyc differ