This commit is contained in:
codeboss 2024-08-01 10:05:05 +08:00
parent bbcf0921ba
commit b7f71fb29f
3 changed files with 5 additions and 4 deletions

View File

@ -6,7 +6,6 @@
<component name="ChangeListManager">
<list default="true" id="f609c0f2-cd0d-4eea-87f1-8caf02d3f04f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frame/ContentView.py" beforeDir="false" afterPath="$PROJECT_DIR$/frame/ContentView.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/directed_acyclic_graph/DAGLayout.py" beforeDir="false" afterPath="$PROJECT_DIR$/graph/directed_acyclic_graph/DAGLayout.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />

View File

@ -1,5 +1,6 @@
from graph.DataType import Point, Arrow
from typing import List, Dict, Tuple
from math import floor,ceil
class DAGLayerHelper:
@ -241,9 +242,10 @@ class DAGGraph:
if len(target_nodes_within_layer) == 0:
return
# 初始化节点排序
if layer_index == 0:
for idx in range(0, len(target_nodes_within_layer)):
target_nodes_within_layer[idx].sort_number = idx
target_nodes_within_layer[idx].sort_number = idx + 1
pass
pass
@ -262,9 +264,9 @@ class DAGGraph:
# 整理节点排序
target_nodes_within_layer.sort(key=compare_item)
for idx in range(0, len(target_nodes_within_layer)):
target_nodes_within_layer[idx].sort_number = idx
target_item = target_nodes_within_layer[idx]
target_item.sort_number = idx + 1
pass
pass
self.__graph_layer_nodes_sort(layer_index + 1, nodes)