kececilayout 0.4.6__py3-none-any.whl → 0.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kececilayout/__init__.py +5 -10
- kececilayout/_version.py +3 -1
- kececilayout/kececi_layout.py +188 -42
- {kececilayout-0.4.6.dist-info → kececilayout-0.4.8.dist-info}/METADATA +131 -33
- kececilayout-0.4.8.dist-info/RECORD +8 -0
- kececilayout-0.4.6.dist-info/RECORD +0 -8
- {kececilayout-0.4.6.dist-info → kececilayout-0.4.8.dist-info}/WHEEL +0 -0
- {kececilayout-0.4.6.dist-info → kececilayout-0.4.8.dist-info}/licenses/LICENSE +0 -0
- {kececilayout-0.4.6.dist-info → kececilayout-0.4.8.dist-info}/top_level.txt +0 -0
kececilayout/__init__.py
CHANGED
|
@@ -10,7 +10,7 @@ import inspect
|
|
|
10
10
|
import warnings
|
|
11
11
|
|
|
12
12
|
# Paket sürüm numarası
|
|
13
|
-
__version__ = "0.4.
|
|
13
|
+
__version__ = "0.4.8"
|
|
14
14
|
|
|
15
15
|
# =============================================================================
|
|
16
16
|
# OTOMATİK İÇE AKTARMA VE __all__ OLUŞTURMA
|
|
@@ -40,6 +40,8 @@ from .kececi_layout import ( # Veya fonksiyonların bulunduğu asıl modül
|
|
|
40
40
|
kececi_layout_graphillion,
|
|
41
41
|
kececi_layout_rx,
|
|
42
42
|
kececi_layout_rustworkx,
|
|
43
|
+
kececi_layout_gt,
|
|
44
|
+
kececi_layout_graph_tool,
|
|
43
45
|
kececi_layout_pure,
|
|
44
46
|
load_element_data_and_spectral_lines,
|
|
45
47
|
wavelength_to_rgb,
|
|
@@ -78,6 +80,8 @@ __all__ = [
|
|
|
78
80
|
'kececi_layout_graphillion',
|
|
79
81
|
'kececi_layout_rx',
|
|
80
82
|
'kececi_layout_rustworkx',
|
|
83
|
+
'kececi_layout_gt',
|
|
84
|
+
'kececi_layout_graph_tool',
|
|
81
85
|
'kececi_layout_pure',
|
|
82
86
|
'load_element_data_and_spectral_lines',
|
|
83
87
|
'wavelength_to_rgb',
|
|
@@ -135,12 +139,3 @@ def old_function_placeholder():
|
|
|
135
139
|
# Eğer bu eski fonksiyonu da dışa aktarmak istiyorsanız, __all__ listesine ekleyin
|
|
136
140
|
# __all__.append('old_function_placeholder')
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
kececilayout/_version.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# _version.py
|
|
2
2
|
|
|
3
|
-
__version__ = "0.4.
|
|
3
|
+
__version__ = "0.4.8"
|
|
4
4
|
__license__ = "MIT"
|
|
5
5
|
__description__ = "A deterministic node placement algorithm used in graph visualization. In this layout, nodes are arranged sequentially along a defined primary axis. Each subsequent node is then alternately offset along a secondary, perpendicular axis, typically moving to one side of the primary axis and then the other. Often, the magnitude of this secondary offset increases as nodes progress along the primary axis, creating a characteristic zig-zag or serpentine pattern."
|
|
6
6
|
__author__ = "Mehmet Keçeci"
|
|
7
7
|
__url__ = "https://github.com/WhiteSymmetry/kececilayout"
|
|
8
8
|
__docs__ = "https://github.com/WhiteSymmetry/kececilayout" # Opsiyonel: Dokümantasyon linki
|
|
9
9
|
__dependencies__ = ["python>=3.10"] # Diğer bağımlılıkları da ekleyebilirsiniz
|
|
10
|
+
|
|
11
|
+
|
kececilayout/kececi_layout.py
CHANGED
|
@@ -16,6 +16,7 @@ from mpl_toolkits.mplot3d import Axes3D
|
|
|
16
16
|
import networkit as nk
|
|
17
17
|
import networkx as nx
|
|
18
18
|
import numpy as np # rustworkx
|
|
19
|
+
import platform # graph_tool için
|
|
19
20
|
import random
|
|
20
21
|
import rustworkx as rx
|
|
21
22
|
import warnings
|
|
@@ -48,6 +49,14 @@ try:
|
|
|
48
49
|
import graphillion as gg
|
|
49
50
|
except ImportError:
|
|
50
51
|
gg = None
|
|
52
|
+
# graph-tool sadece Linux'ta import edilsin
|
|
53
|
+
if platform.system() == "Linux":
|
|
54
|
+
try:
|
|
55
|
+
import graph_tool.all as gt
|
|
56
|
+
except ImportError:
|
|
57
|
+
gt = None
|
|
58
|
+
else:
|
|
59
|
+
gt = None
|
|
51
60
|
|
|
52
61
|
|
|
53
62
|
def find_max_node_id(edges):
|
|
@@ -89,9 +98,8 @@ def kececi_layout(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
89
98
|
expanding=True):
|
|
90
99
|
"""
|
|
91
100
|
Calculates 2D sequential-zigzag coordinates for the nodes of a graph.
|
|
92
|
-
|
|
93
101
|
This function is compatible with graphs from NetworkX, Rustworkx, igraph,
|
|
94
|
-
Networkit, and
|
|
102
|
+
Networkit, Graphillion, and graph-tool.
|
|
95
103
|
|
|
96
104
|
Args:
|
|
97
105
|
graph: A graph object from a supported library.
|
|
@@ -105,26 +113,41 @@ def kececi_layout(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
105
113
|
Returns:
|
|
106
114
|
dict: A dictionary of positions formatted as {node_id: (x, y)}.
|
|
107
115
|
"""
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
nodes = None
|
|
117
|
+
|
|
118
|
+
# graph-tool desteği
|
|
119
|
+
if gt and isinstance(graph, gt.Graph):
|
|
120
|
+
nodes = sorted([int(v) for v in graph.get_vertices()])
|
|
121
|
+
elif gg and isinstance(graph, gg.GraphSet):
|
|
122
|
+
edges = graph.universe()
|
|
123
|
+
max_node_id = max(set(itertools.chain.from_iterable(edges))) if edges else 0
|
|
124
|
+
nodes = list(range(1, max_node_id + 1)) if max_node_id > 0 else []
|
|
125
|
+
elif ig and isinstance(graph, ig.Graph):
|
|
126
|
+
nodes = sorted([v.index for v in graph.vs])
|
|
127
|
+
elif nk and isinstance(graph, nk.graph.Graph):
|
|
128
|
+
nodes = sorted(list(graph.iterNodes()))
|
|
129
|
+
elif rx and isinstance(graph, (rx.PyGraph, rx.PyDiGraph)):
|
|
130
|
+
nodes = sorted(graph.node_indices())
|
|
131
|
+
elif isinstance(graph, nx.Graph):
|
|
132
|
+
try:
|
|
133
|
+
nodes = sorted(list(graph.nodes()))
|
|
134
|
+
except TypeError:
|
|
135
|
+
nodes = list(graph.nodes())
|
|
136
|
+
else:
|
|
137
|
+
supported = ["NetworkX", "Rustworkx", "igraph", "Networkit", "Graphillion"]
|
|
138
|
+
if gt:
|
|
139
|
+
supported.append("graph-tool")
|
|
140
|
+
raise TypeError(f"Unsupported graph type: {type(graph)}. Supported: {', '.join(supported)}")
|
|
114
141
|
|
|
115
142
|
pos = {}
|
|
116
|
-
|
|
117
|
-
# --- DOĞRULANMIŞ KONTROL BLOĞU ---
|
|
118
143
|
is_vertical = primary_direction in ['top_down', 'bottom_up']
|
|
119
144
|
is_horizontal = primary_direction in ['left-to-right', 'right-to-left']
|
|
120
|
-
|
|
121
145
|
if not (is_vertical or is_horizontal):
|
|
122
146
|
raise ValueError(f"Invalid primary_direction: '{primary_direction}'")
|
|
123
147
|
if is_vertical and secondary_start not in ['right', 'left']:
|
|
124
148
|
raise ValueError(f"Invalid secondary_start for vertical direction: '{secondary_start}'")
|
|
125
149
|
if is_horizontal and secondary_start not in ['up', 'down']:
|
|
126
150
|
raise ValueError(f"Invalid secondary_start for horizontal direction: '{secondary_start}'")
|
|
127
|
-
# --- BİTİŞ ---
|
|
128
151
|
|
|
129
152
|
for i, node_id in enumerate(nodes):
|
|
130
153
|
primary_coord, secondary_axis = 0.0, ''
|
|
@@ -134,16 +157,14 @@ def kececi_layout(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
134
157
|
primary_coord, secondary_axis = i * primary_spacing, 'x'
|
|
135
158
|
elif primary_direction == 'left-to-right':
|
|
136
159
|
primary_coord, secondary_axis = i * primary_spacing, 'y'
|
|
137
|
-
else:
|
|
160
|
+
else: # 'right-to-left'
|
|
138
161
|
primary_coord, secondary_axis = i * -primary_spacing, 'y'
|
|
139
|
-
|
|
140
162
|
secondary_offset = 0.0
|
|
141
163
|
if i > 0:
|
|
142
164
|
start_multiplier = 1.0 if secondary_start in ['right', 'up'] else -1.0
|
|
143
165
|
magnitude = math.ceil(i / 2.0) if expanding else 1.0
|
|
144
166
|
side = 1 if i % 2 != 0 else -1
|
|
145
167
|
secondary_offset = start_multiplier * magnitude * side * secondary_spacing
|
|
146
|
-
|
|
147
168
|
x, y = ((secondary_offset, primary_coord) if secondary_axis == 'x' else
|
|
148
169
|
(primary_coord, secondary_offset))
|
|
149
170
|
pos[node_id] = (x, y)
|
|
@@ -157,18 +178,17 @@ def kececi_layout(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
157
178
|
|
|
158
179
|
def kececi_layout_v4(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
159
180
|
primary_direction='top_down', secondary_start='right',
|
|
160
|
-
expanding=True):
|
|
181
|
+
expanding=True):
|
|
161
182
|
"""
|
|
162
183
|
Calculates 2D sequential-zigzag coordinates for the nodes of a graph.
|
|
163
|
-
|
|
164
184
|
This function is compatible with graphs from NetworkX, Rustworkx, igraph,
|
|
165
|
-
Networkit, and
|
|
185
|
+
Networkit, Graphillion, and graph-tool.
|
|
166
186
|
|
|
167
187
|
Args:
|
|
168
188
|
graph: A graph object from a supported library.
|
|
169
189
|
primary_spacing (float): The distance between nodes along the primary axis.
|
|
170
190
|
secondary_spacing (float): The base unit for the zigzag offset.
|
|
171
|
-
primary_direction (str): 'top_down', 'bottom_up', '
|
|
191
|
+
primary_direction (str): 'top_down', 'bottom_up', 'left-to-right', 'right-to-left'.
|
|
172
192
|
secondary_start (str): Initial direction for the zigzag ('up', 'down', 'left', 'right').
|
|
173
193
|
expanding (bool): If True (default), the zigzag offset grows, creating the
|
|
174
194
|
triangle-like 'v4' style. If False, the offset is constant,
|
|
@@ -177,12 +197,12 @@ def kececi_layout_v4(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
177
197
|
Returns:
|
|
178
198
|
dict: A dictionary of positions formatted as {node_id: (x, y)}.
|
|
179
199
|
"""
|
|
180
|
-
# ==========================================================
|
|
181
|
-
# Sizin orijinal, çoklu kütüphane uyumluluk bloğunuz burada korunuyor.
|
|
182
|
-
# Bu, kodun sağlamlığını garanti eder.
|
|
183
|
-
# ==========================================================
|
|
184
200
|
nodes = None
|
|
185
|
-
|
|
201
|
+
|
|
202
|
+
# graph-tool desteği
|
|
203
|
+
if gt and isinstance(graph, gt.Graph):
|
|
204
|
+
nodes = sorted([int(v) for v in graph.get_vertices()])
|
|
205
|
+
elif gg and isinstance(graph, gg.GraphSet):
|
|
186
206
|
edges = graph.universe()
|
|
187
207
|
max_node_id = max(set(itertools.chain.from_iterable(edges))) if edges else 0
|
|
188
208
|
nodes = list(range(1, max_node_id + 1)) if max_node_id > 0 else []
|
|
@@ -199,13 +219,13 @@ def kececi_layout_v4(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
199
219
|
nodes = list(graph.nodes())
|
|
200
220
|
else:
|
|
201
221
|
supported = ["NetworkX", "Rustworkx", "igraph", "Networkit", "Graphillion"]
|
|
222
|
+
if gt:
|
|
223
|
+
supported.append("graph-tool")
|
|
202
224
|
raise TypeError(f"Unsupported graph type: {type(graph)}. Supported: {', '.join(supported)}")
|
|
203
|
-
# ==========================================================
|
|
204
225
|
|
|
205
226
|
pos = {}
|
|
206
227
|
is_vertical = primary_direction in ['top_down', 'bottom_up']
|
|
207
228
|
is_horizontal = primary_direction in ['left-to-right', 'right-to-left']
|
|
208
|
-
|
|
209
229
|
if not (is_vertical or is_horizontal):
|
|
210
230
|
raise ValueError(f"Invalid primary_direction: {primary_direction}")
|
|
211
231
|
if is_vertical and secondary_start not in ['right', 'left']:
|
|
@@ -221,24 +241,17 @@ def kececi_layout_v4(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
|
221
241
|
primary_coord, secondary_axis = i * primary_spacing, 'x'
|
|
222
242
|
elif primary_direction == 'left-to-right':
|
|
223
243
|
primary_coord, secondary_axis = i * primary_spacing, 'y'
|
|
224
|
-
else: # '
|
|
244
|
+
else: # 'right-to-left'
|
|
225
245
|
primary_coord, secondary_axis = i * -primary_spacing, 'y'
|
|
226
|
-
|
|
227
246
|
secondary_offset = 0.0
|
|
228
247
|
if i > 0:
|
|
229
248
|
start_multiplier = 1.0 if secondary_start in ['right', 'up'] else -1.0
|
|
230
|
-
|
|
231
|
-
# --- YENİ ESNEK MANTIK BURADA ---
|
|
232
|
-
# `expanding` True ise 'v4' stili gibi genişler, değilse sabit kalır.
|
|
233
249
|
magnitude = math.ceil(i / 2.0) if expanding else 1.0
|
|
234
|
-
|
|
235
250
|
side = 1 if i % 2 != 0 else -1
|
|
236
251
|
secondary_offset = start_multiplier * magnitude * side * secondary_spacing
|
|
237
|
-
|
|
238
252
|
x, y = ((secondary_offset, primary_coord) if secondary_axis == 'x' else
|
|
239
253
|
(primary_coord, secondary_offset))
|
|
240
254
|
pos[node_id] = (x, y)
|
|
241
|
-
|
|
242
255
|
return pos
|
|
243
256
|
|
|
244
257
|
def kececi_layout_nx(graph, primary_spacing=1.0, secondary_spacing=1.0,
|
|
@@ -877,6 +890,98 @@ def kececi_layout_rustworkx(graph: "rx.PyGraph", primary_spacing=1.0, secondary_
|
|
|
877
890
|
|
|
878
891
|
return pos
|
|
879
892
|
|
|
893
|
+
def kececi_layout_gt(graph: "gt.Graph", primary_spacing=1.0, secondary_spacing=1.0,
|
|
894
|
+
primary_direction='top_down', secondary_start='right',
|
|
895
|
+
expanding=True):
|
|
896
|
+
"""
|
|
897
|
+
Expanding Kececi Layout: Progresses along the primary axis, with an offset
|
|
898
|
+
on the secondary axis.
|
|
899
|
+
Kececi layout for a graph-tool graph object.
|
|
900
|
+
Args:
|
|
901
|
+
graph (graph_tool.Graph): A graph-tool graph object.
|
|
902
|
+
primary_spacing (float): The spacing between nodes on the primary axis.
|
|
903
|
+
secondary_spacing (float): The offset spacing on the secondary axis.
|
|
904
|
+
primary_direction (str): 'top_down', 'bottom_up', 'left-to-right', 'right-to-left'.
|
|
905
|
+
secondary_start (str): Initial direction for the offset ('right', 'left', 'up', 'down').
|
|
906
|
+
Returns:
|
|
907
|
+
dict: A dictionary of positions keyed by node index.
|
|
908
|
+
"""
|
|
909
|
+
nodes = sorted([int(v) for v in graph.vertices()])
|
|
910
|
+
pos = {}
|
|
911
|
+
is_vertical = primary_direction in ['top_down', 'bottom_up']
|
|
912
|
+
is_horizontal = primary_direction in ['left-to-right', 'right-to-left']
|
|
913
|
+
if not (is_vertical or is_horizontal):
|
|
914
|
+
raise ValueError(f"Invalid primary_direction: {primary_direction}")
|
|
915
|
+
if is_vertical and secondary_start not in ['right', 'left']:
|
|
916
|
+
raise ValueError(f"Invalid secondary_start for vertical direction: {secondary_start}")
|
|
917
|
+
if is_horizontal and secondary_start not in ['up', 'down']:
|
|
918
|
+
raise ValueError(f"Invalid secondary_start for horizontal direction: {secondary_start}")
|
|
919
|
+
|
|
920
|
+
for i, node_id in enumerate(nodes):
|
|
921
|
+
if primary_direction == 'top_down':
|
|
922
|
+
primary_coord, secondary_axis = i * -primary_spacing, 'x'
|
|
923
|
+
elif primary_direction == 'bottom_up':
|
|
924
|
+
primary_coord, secondary_axis = i * primary_spacing, 'x'
|
|
925
|
+
elif primary_direction == 'left-to-right':
|
|
926
|
+
primary_coord, secondary_axis = i * primary_spacing, 'y'
|
|
927
|
+
else:
|
|
928
|
+
primary_coord, secondary_axis = i * -primary_spacing, 'y'
|
|
929
|
+
secondary_offset = 0.0
|
|
930
|
+
if i > 0:
|
|
931
|
+
start_multiplier = 1.0 if secondary_start in ['right', 'up'] else -1.0
|
|
932
|
+
magnitude = math.ceil(i / 2.0) if expanding else 1.0
|
|
933
|
+
side = 1 if i % 2 != 0 else -1
|
|
934
|
+
secondary_offset = start_multiplier * magnitude * side * secondary_spacing
|
|
935
|
+
x, y = (secondary_offset, primary_coord) if secondary_axis == 'x' else (primary_coord, secondary_offset)
|
|
936
|
+
pos[node_id] = (x, y)
|
|
937
|
+
return pos
|
|
938
|
+
|
|
939
|
+
def kececi_layout_graph_tool(graph: "gt.Graph", primary_spacing=1.0, secondary_spacing=1.0,
|
|
940
|
+
primary_direction='top_down', secondary_start='right',
|
|
941
|
+
expanding=True):
|
|
942
|
+
"""
|
|
943
|
+
Expanding Kececi Layout: Progresses along the primary axis, with an offset
|
|
944
|
+
on the secondary axis.
|
|
945
|
+
Kececi layout for a graph-tool graph object.
|
|
946
|
+
Args:
|
|
947
|
+
graph (graph_tool.Graph): A graph-tool graph object.
|
|
948
|
+
primary_spacing (float): The spacing between nodes on the primary axis.
|
|
949
|
+
secondary_spacing (float): The offset spacing on the secondary axis.
|
|
950
|
+
primary_direction (str): 'top_down', 'bottom_up', 'left-to-right', 'right-to-left'.
|
|
951
|
+
secondary_start (str): Initial direction for the offset ('right', 'left', 'up', 'down').
|
|
952
|
+
Returns:
|
|
953
|
+
dict: A dictionary of positions keyed by node index.
|
|
954
|
+
"""
|
|
955
|
+
nodes = sorted([int(v) for v in graph.vertices()])
|
|
956
|
+
pos = {}
|
|
957
|
+
is_vertical = primary_direction in ['top_down', 'bottom_up']
|
|
958
|
+
is_horizontal = primary_direction in ['left-to-right', 'right-to-left']
|
|
959
|
+
if not (is_vertical or is_horizontal):
|
|
960
|
+
raise ValueError(f"Invalid primary_direction: {primary_direction}")
|
|
961
|
+
if is_vertical and secondary_start not in ['right', 'left']:
|
|
962
|
+
raise ValueError(f"Invalid secondary_start for vertical direction: {secondary_start}")
|
|
963
|
+
if is_horizontal and secondary_start not in ['up', 'down']:
|
|
964
|
+
raise ValueError(f"Invalid secondary_start for horizontal direction: {secondary_start}")
|
|
965
|
+
|
|
966
|
+
for i, node_id in enumerate(nodes):
|
|
967
|
+
if primary_direction == 'top_down':
|
|
968
|
+
primary_coord, secondary_axis = i * -primary_spacing, 'x'
|
|
969
|
+
elif primary_direction == 'bottom_up':
|
|
970
|
+
primary_coord, secondary_axis = i * primary_spacing, 'x'
|
|
971
|
+
elif primary_direction == 'left-to-right':
|
|
972
|
+
primary_coord, secondary_axis = i * primary_spacing, 'y'
|
|
973
|
+
else:
|
|
974
|
+
primary_coord, secondary_axis = i * -primary_spacing, 'y'
|
|
975
|
+
secondary_offset = 0.0
|
|
976
|
+
if i > 0:
|
|
977
|
+
start_multiplier = 1.0 if secondary_start in ['right', 'up'] else -1.0
|
|
978
|
+
magnitude = math.ceil(i / 2.0) if expanding else 1.0
|
|
979
|
+
side = 1 if i % 2 != 0 else -1
|
|
980
|
+
secondary_offset = start_multiplier * magnitude * side * secondary_spacing
|
|
981
|
+
x, y = (secondary_offset, primary_coord) if secondary_axis == 'x' else (primary_coord, secondary_offset)
|
|
982
|
+
pos[node_id] = (x, y)
|
|
983
|
+
return pos
|
|
984
|
+
|
|
880
985
|
def kececi_layout_pure(nodes, primary_spacing=1.0, secondary_spacing=1.0,
|
|
881
986
|
primary_direction='top_down', secondary_start='right',
|
|
882
987
|
expanding=True):
|
|
@@ -1113,7 +1218,7 @@ def to_networkx(graph):
|
|
|
1113
1218
|
return graph.copy()
|
|
1114
1219
|
|
|
1115
1220
|
nx_graph = nx.Graph()
|
|
1116
|
-
|
|
1221
|
+
"""
|
|
1117
1222
|
# PyZX graph support
|
|
1118
1223
|
try:
|
|
1119
1224
|
import pyzx as zx
|
|
@@ -1122,11 +1227,43 @@ def to_networkx(graph):
|
|
|
1122
1227
|
for v in graph.vertices():
|
|
1123
1228
|
nx_graph.add_node(v)
|
|
1124
1229
|
for edge in graph.edges():
|
|
1125
|
-
if len(edge) == 2:
|
|
1230
|
+
if len(edge) == 2: # TypeError: object of type 'Edge' has no len()
|
|
1126
1231
|
nx_graph.add_edge(edge[0], edge[1])
|
|
1127
1232
|
return nx_graph
|
|
1128
1233
|
except ImportError:
|
|
1129
1234
|
pass
|
|
1235
|
+
"""
|
|
1236
|
+
|
|
1237
|
+
# PyZX graph support
|
|
1238
|
+
try:
|
|
1239
|
+
import pyzx as zx
|
|
1240
|
+
if hasattr(graph, 'vertices') and hasattr(graph, 'edges'):
|
|
1241
|
+
for v in graph.vertices():
|
|
1242
|
+
nx_graph.add_node(v)
|
|
1243
|
+
for edge in graph.edges():
|
|
1244
|
+
# PyZX kenarları için doğru erişim
|
|
1245
|
+
u, v = edge.u, edge.v # PyZX kenarları için uygun erişim
|
|
1246
|
+
nx_graph.add_edge(u, v)
|
|
1247
|
+
return nx_graph
|
|
1248
|
+
except ImportError:
|
|
1249
|
+
pass
|
|
1250
|
+
except AttributeError:
|
|
1251
|
+
pass # PyZX kenarları için uygun erişim yoksa, bu bloğu atla
|
|
1252
|
+
|
|
1253
|
+
# graph-tool desteği
|
|
1254
|
+
if gt and isinstance(graph, gt.Graph):
|
|
1255
|
+
# Düğümleri ekle
|
|
1256
|
+
for v in graph.vertices():
|
|
1257
|
+
node_id = int(v)
|
|
1258
|
+
nx_graph.add_node(node_id)
|
|
1259
|
+
|
|
1260
|
+
# Kenarları ekle
|
|
1261
|
+
for e in graph.edges():
|
|
1262
|
+
source = int(e.source())
|
|
1263
|
+
target = int(e.target())
|
|
1264
|
+
nx_graph.add_edge(source, target)
|
|
1265
|
+
|
|
1266
|
+
return nx_graph
|
|
1130
1267
|
|
|
1131
1268
|
# Diğer graph kütüphaneleri...
|
|
1132
1269
|
if rx and isinstance(graph, (rx.PyGraph, rx.PyDiGraph)):
|
|
@@ -1392,7 +1529,7 @@ def draw_kececi(graph, style='curved', ax=None, **kwargs):
|
|
|
1392
1529
|
Draws a graph using the Keçeci Layout with a specified style.
|
|
1393
1530
|
|
|
1394
1531
|
This function automatically handles graphs from different libraries
|
|
1395
|
-
(
|
|
1532
|
+
(Networkx, Networkit, Rustworkx, igraph, Graphillion, graph-tool,etc.).
|
|
1396
1533
|
|
|
1397
1534
|
Args:
|
|
1398
1535
|
graph: The graph object to be drawn.
|
|
@@ -1432,18 +1569,29 @@ if __name__ == '__main__':
|
|
|
1432
1569
|
print("Testing kececilayout.py module...")
|
|
1433
1570
|
G_test = nx.gnp_random_graph(12, 0.3, seed=42)
|
|
1434
1571
|
|
|
1572
|
+
# graph-tool grafi oluşturma ve test etme
|
|
1573
|
+
if gt:
|
|
1574
|
+
g = gt.Graph()
|
|
1575
|
+
g.add_vertex(12)
|
|
1576
|
+
for u, v in G_test.edges():
|
|
1577
|
+
g.add_edge(g.vertex(u), g.vertex(v))
|
|
1578
|
+
fig_gt = plt.figure(figsize=(10, 8))
|
|
1579
|
+
draw_kececi(g, ax=fig_gt.add_subplot(111), style='curved')
|
|
1580
|
+
plt.title("Keçeci Layout: graph-tool Graph")
|
|
1581
|
+
plt.show()
|
|
1582
|
+
|
|
1435
1583
|
# Compare expanding=False (parallel) vs. expanding=True ('v4' style)
|
|
1436
1584
|
fig_v4 = plt.figure(figsize=(16, 7))
|
|
1437
1585
|
fig_v4.suptitle("Effect of the `expanding` Parameter", fontsize=20)
|
|
1438
1586
|
ax_v4_1 = fig_v4.add_subplot(1, 2, 1)
|
|
1439
1587
|
draw_kececi(G_test, ax=ax_v4_1, style='curved',
|
|
1440
|
-
primary_direction='
|
|
1588
|
+
primary_direction='left-to-right', secondary_start='up',
|
|
1441
1589
|
expanding=False)
|
|
1442
1590
|
ax_v4_1.set_title("Parallel Style (expanding=False)", fontsize=16)
|
|
1443
1591
|
|
|
1444
1592
|
ax_v4_2 = fig_v4.add_subplot(1, 2, 2)
|
|
1445
1593
|
draw_kececi(G_test, ax=ax_v4_2, style='curved',
|
|
1446
|
-
primary_direction='
|
|
1594
|
+
primary_direction='left-to-right', secondary_start='up',
|
|
1447
1595
|
expanding=True)
|
|
1448
1596
|
ax_v4_2.set_title("Expanding 'v4' Style (expanding=True)", fontsize=16)
|
|
1449
1597
|
plt.show()
|
|
@@ -1452,11 +1600,9 @@ if __name__ == '__main__':
|
|
|
1452
1600
|
fig_styles = plt.figure(figsize=(18, 12))
|
|
1453
1601
|
fig_styles.suptitle("Advanced Drawing Styles Test", fontsize=20)
|
|
1454
1602
|
draw_kececi(G_test, style='curved', ax=fig_styles.add_subplot(2, 2, 1),
|
|
1455
|
-
primary_direction='
|
|
1603
|
+
primary_direction='left-to-right', secondary_start='up', expanding=True)
|
|
1456
1604
|
draw_kececi(G_test, style='transparent', ax=fig_styles.add_subplot(2, 2, 2),
|
|
1457
1605
|
primary_direction='top_down', secondary_start='left', expanding=True, node_color='purple')
|
|
1458
1606
|
draw_kececi(G_test, style='3d', ax=fig_styles.add_subplot(2, 2, (3, 4), projection='3d'))
|
|
1459
1607
|
plt.tight_layout(rect=[0, 0, 1, 0.96])
|
|
1460
1608
|
plt.show()
|
|
1461
|
-
|
|
1462
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kececilayout
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.8
|
|
4
4
|
Summary: Çeşitli graf kütüphaneleri için sıralı-zigzag yerleşimleri sağlayan bir Python paketi.
|
|
5
5
|
Home-page: https://github.com/WhiteSymmetry/kececilayout
|
|
6
6
|
Author: Mehmet Keçeci
|
|
@@ -53,6 +53,7 @@ Requires-Dist: python-louvain; extra == "test"
|
|
|
53
53
|
Requires-Dist: rustworkx; extra == "test"
|
|
54
54
|
Requires-Dist: networkit; extra == "test"
|
|
55
55
|
Requires-Dist: graphillion; extra == "test"
|
|
56
|
+
Requires-Dist: graph-tool; extra == "test"
|
|
56
57
|
Dynamic: author
|
|
57
58
|
Dynamic: home-page
|
|
58
59
|
Dynamic: license-file
|
|
@@ -228,7 +229,7 @@ try:
|
|
|
228
229
|
import kececilayout as kl
|
|
229
230
|
except ImportError:
|
|
230
231
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
231
|
-
print("Please ensure the file containing
|
|
232
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
232
233
|
exit()
|
|
233
234
|
|
|
234
235
|
# --- General Layout Parameters ---
|
|
@@ -252,7 +253,7 @@ try:
|
|
|
252
253
|
# Calculate layout
|
|
253
254
|
print("Calculating Keçeci Layout...")
|
|
254
255
|
# Call the layout function from the imported module
|
|
255
|
-
pos_rx = kl.
|
|
256
|
+
pos_rx = kl.kececi_layout(G_rx, **LAYOUT_PARAMS)
|
|
256
257
|
# print("Rustworkx positions:", pos_rx) # Debug print if needed
|
|
257
258
|
|
|
258
259
|
# Plot using Matplotlib directly (Rustworkx doesn't have a built-in draw)
|
|
@@ -322,7 +323,7 @@ try:
|
|
|
322
323
|
import kececilayout as kl
|
|
323
324
|
except ImportError:
|
|
324
325
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
325
|
-
print("Please ensure the file containing
|
|
326
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
326
327
|
exit()
|
|
327
328
|
|
|
328
329
|
# --- General Layout Parameters ---
|
|
@@ -355,7 +356,7 @@ try:
|
|
|
355
356
|
# Calculate layout
|
|
356
357
|
print("Calculating Keçeci Layout...")
|
|
357
358
|
# Call the layout function from the imported module
|
|
358
|
-
pos_nk = kl.
|
|
359
|
+
pos_nk = kl.kececi_layout(G_nk, **LAYOUT_PARAMS)
|
|
359
360
|
# print("Networkit positions:", pos_nk) # Debug print if needed
|
|
360
361
|
|
|
361
362
|
# Plot using Matplotlib directly (Networkit doesn't have a simple built-in draw)
|
|
@@ -409,6 +410,8 @@ print("\n--- Networkit Example Finished ---")
|
|
|
409
410
|
|
|
410
411
|

|
|
411
412
|
|
|
413
|
+
---
|
|
414
|
+
|
|
412
415
|
#### Example with Graphillion
|
|
413
416
|
|
|
414
417
|
```python
|
|
@@ -425,7 +428,7 @@ try:
|
|
|
425
428
|
import kececilayout as kl
|
|
426
429
|
except ImportError:
|
|
427
430
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
428
|
-
print("Please ensure the file containing
|
|
431
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
429
432
|
exit()
|
|
430
433
|
|
|
431
434
|
# --- General Layout Parameters ---
|
|
@@ -459,7 +462,7 @@ try:
|
|
|
459
462
|
print("Calculating Keçeci Layout...")
|
|
460
463
|
# Call the layout function; it should handle the Graphillion GraphSet object
|
|
461
464
|
# and likely use 1-based indexing based on the universe.
|
|
462
|
-
pos_gg = kl.
|
|
465
|
+
pos_gg = kl.kececi_layout(gs, **LAYOUT_PARAMS)
|
|
463
466
|
# print("Graphillion positions:", pos_gg) # Debug print if needed
|
|
464
467
|
|
|
465
468
|
# Plot using Matplotlib directly (Graphillion has no plotting)
|
|
@@ -517,6 +520,90 @@ print("\n--- Graphillion Example Finished ---")
|
|
|
517
520
|
|
|
518
521
|
---
|
|
519
522
|
|
|
523
|
+
#### Example with graph-tool
|
|
524
|
+
|
|
525
|
+
```python
|
|
526
|
+
import matplotlib.pyplot as plt
|
|
527
|
+
from matplotlib.collections import LineCollection
|
|
528
|
+
import graph_tool.all as gt
|
|
529
|
+
import kececilayout as kl
|
|
530
|
+
|
|
531
|
+
# --- General Layout Parameters ---
|
|
532
|
+
LAYOUT_PARAMS = {
|
|
533
|
+
'primary_spacing': 1.0,
|
|
534
|
+
'secondary_spacing': 0.6,
|
|
535
|
+
'primary_direction': 'top_down',
|
|
536
|
+
'secondary_start': 'right'
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
N_NODES = 10 # Number of nodes in the example graph
|
|
540
|
+
|
|
541
|
+
try:
|
|
542
|
+
print("\n--- graph-tool Example ---")
|
|
543
|
+
|
|
544
|
+
# Create a graph-tool Graph
|
|
545
|
+
g = gt.Graph(directed=False)
|
|
546
|
+
|
|
547
|
+
# Add nodes
|
|
548
|
+
nodes = [g.add_vertex() for _ in range(N_NODES)]
|
|
549
|
+
|
|
550
|
+
# Add edges (1-2, 2-3, ..., (N_NODES-1)-N_NODES)
|
|
551
|
+
for i in range(N_NODES - 1):
|
|
552
|
+
g.add_edge(nodes[i], nodes[i + 1])
|
|
553
|
+
|
|
554
|
+
# Calculate layout using kececilayout_v4
|
|
555
|
+
print("Calculating Keçeci Layout...")
|
|
556
|
+
pos_gt = kl.kececi_layout(g, **LAYOUT_PARAMS)
|
|
557
|
+
|
|
558
|
+
# Plot using Matplotlib
|
|
559
|
+
print("Plotting graph using Matplotlib...")
|
|
560
|
+
plt.figure(figsize=(6, 8))
|
|
561
|
+
ax = plt.gca()
|
|
562
|
+
|
|
563
|
+
# Extract node positions
|
|
564
|
+
node_indices_gt = list(range(N_NODES))
|
|
565
|
+
x_coords_gt = [pos_gt[i][0] for i in node_indices_gt]
|
|
566
|
+
y_coords_gt = [pos_gt[i][1] for i in node_indices_gt]
|
|
567
|
+
|
|
568
|
+
# Draw nodes
|
|
569
|
+
ax.scatter(x_coords_gt, y_coords_gt, s=700, c='gold', zorder=2, label='Nodes')
|
|
570
|
+
|
|
571
|
+
# Draw labels
|
|
572
|
+
for i in node_indices_gt:
|
|
573
|
+
ax.text(pos_gt[i][0], pos_gt[i][1], str(i + 1), ha='center', va='center', fontsize=10, zorder=3)
|
|
574
|
+
|
|
575
|
+
# Draw edges
|
|
576
|
+
edge_lines_gt = []
|
|
577
|
+
for edge in g.edges():
|
|
578
|
+
source = int(edge.source())
|
|
579
|
+
target = int(edge.target())
|
|
580
|
+
edge_lines_gt.append([pos_gt[source], pos_gt[target]])
|
|
581
|
+
|
|
582
|
+
if edge_lines_gt:
|
|
583
|
+
lc_gt = LineCollection(edge_lines_gt, colors='gray', linewidths=1.0, zorder=1, label='Edges')
|
|
584
|
+
ax.add_collection(lc_gt)
|
|
585
|
+
|
|
586
|
+
plt.title(f"graph-tool ({N_NODES} Nodes) with Keçeci Layout (Matplotlib)")
|
|
587
|
+
plt.xlabel("X Coordinate")
|
|
588
|
+
plt.ylabel("Y Coordinate")
|
|
589
|
+
plt.axis('equal')
|
|
590
|
+
plt.grid(False)
|
|
591
|
+
plt.show()
|
|
592
|
+
|
|
593
|
+
except ImportError:
|
|
594
|
+
print("graph-tool is not installed. Skipping this example.")
|
|
595
|
+
except Exception as e:
|
|
596
|
+
print(f"An error occurred in the graph-tool example: {e}")
|
|
597
|
+
import traceback
|
|
598
|
+
traceback.print_exc()
|
|
599
|
+
|
|
600
|
+
print("\n--- graph-tool Example Finished ---")
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+

|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
520
607
|
### Supported Backends
|
|
521
608
|
|
|
522
609
|
- **NetworkX**
|
|
@@ -524,8 +611,9 @@ print("\n--- Graphillion Example Finished ---")
|
|
|
524
611
|
- **Rustworkx**
|
|
525
612
|
- **Networkit**
|
|
526
613
|
- **Graphillion**
|
|
614
|
+
- **graph-tool**
|
|
527
615
|
|
|
528
|
-
*Note: All backends are supported via unified `
|
|
616
|
+
*Note: All backends are supported via unified `kececi_layout` function.*
|
|
529
617
|
|
|
530
618
|
---
|
|
531
619
|
|
|
@@ -641,7 +729,7 @@ try:
|
|
|
641
729
|
import kececilayout as kl
|
|
642
730
|
except ImportError:
|
|
643
731
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
644
|
-
print("Please ensure the file containing
|
|
732
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
645
733
|
exit()
|
|
646
734
|
|
|
647
735
|
# --- General Layout Parameters ---
|
|
@@ -665,7 +753,7 @@ try:
|
|
|
665
753
|
# Calculate layout
|
|
666
754
|
print("Calculating Keçeci Layout...")
|
|
667
755
|
# Call the layout function from the imported module
|
|
668
|
-
pos_ig = kl.
|
|
756
|
+
pos_ig = kl.kececi_layout(G_ig, **LAYOUT_PARAMS)
|
|
669
757
|
# print("igraph positions (dict):", pos_ig) # Debug print if needed
|
|
670
758
|
|
|
671
759
|
# Convert positions dict to list ordered by vertex index for ig.plot
|
|
@@ -732,7 +820,7 @@ try:
|
|
|
732
820
|
import kececilayout as kl
|
|
733
821
|
except ImportError:
|
|
734
822
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
735
|
-
print("Please ensure the file containing
|
|
823
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
736
824
|
exit()
|
|
737
825
|
|
|
738
826
|
# --- General Layout Parameters ---
|
|
@@ -756,7 +844,7 @@ try:
|
|
|
756
844
|
# Calculate layout
|
|
757
845
|
print("Calculating Keçeci Layout...")
|
|
758
846
|
# Call the layout function from the imported module
|
|
759
|
-
pos_rx = kl.
|
|
847
|
+
pos_rx = kl.kececi_layout(G_rx, **LAYOUT_PARAMS)
|
|
760
848
|
# print("Rustworkx positions:", pos_rx) # Debug print if needed
|
|
761
849
|
|
|
762
850
|
# Plot using Matplotlib directly (Rustworkx doesn't have a built-in draw)
|
|
@@ -826,7 +914,7 @@ try:
|
|
|
826
914
|
import kececilayout as kl
|
|
827
915
|
except ImportError:
|
|
828
916
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
829
|
-
print("Please ensure the file containing
|
|
917
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
830
918
|
exit()
|
|
831
919
|
|
|
832
920
|
# --- General Layout Parameters ---
|
|
@@ -859,7 +947,7 @@ try:
|
|
|
859
947
|
# Calculate layout
|
|
860
948
|
print("Calculating Keçeci Layout...")
|
|
861
949
|
# Call the layout function from the imported module
|
|
862
|
-
pos_nk = kl.
|
|
950
|
+
pos_nk = kl.kececi_layout(G_nk, **LAYOUT_PARAMS)
|
|
863
951
|
# print("Networkit positions:", pos_nk) # Debug print if needed
|
|
864
952
|
|
|
865
953
|
# Plot using Matplotlib directly (Networkit doesn't have a simple built-in draw)
|
|
@@ -929,7 +1017,7 @@ try:
|
|
|
929
1017
|
import kececilayout as kl
|
|
930
1018
|
except ImportError:
|
|
931
1019
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
932
|
-
print("Please ensure the file containing
|
|
1020
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
933
1021
|
exit()
|
|
934
1022
|
|
|
935
1023
|
# --- General Layout Parameters ---
|
|
@@ -963,7 +1051,7 @@ try:
|
|
|
963
1051
|
print("Calculating Keçeci Layout...")
|
|
964
1052
|
# Call the layout function; it should handle the Graphillion GraphSet object
|
|
965
1053
|
# and likely use 1-based indexing based on the universe.
|
|
966
|
-
pos_gg = kl.
|
|
1054
|
+
pos_gg = kl.kececi_layout(gs, **LAYOUT_PARAMS)
|
|
967
1055
|
# print("Graphillion positions:", pos_gg) # Debug print if needed
|
|
968
1056
|
|
|
969
1057
|
# Plot using Matplotlib directly (Graphillion has no plotting)
|
|
@@ -1028,8 +1116,9 @@ print("\n--- Graphillion Example Finished ---")
|
|
|
1028
1116
|
- **Rustworkx**
|
|
1029
1117
|
- **Networkit**
|
|
1030
1118
|
- **Graphillion**
|
|
1119
|
+
- **graph-tool**
|
|
1031
1120
|
|
|
1032
|
-
*Not: Tüm kütüphaneler `
|
|
1121
|
+
*Not: Tüm kütüphaneler `kececi_layout` fonksiyonu ile desteklenir.*
|
|
1033
1122
|
|
|
1034
1123
|
---
|
|
1035
1124
|
|
|
@@ -1231,8 +1320,8 @@ import random
|
|
|
1231
1320
|
G = nx.path_graph(10)
|
|
1232
1321
|
|
|
1233
1322
|
# Calculate layout positions using the generic function
|
|
1234
|
-
# (Assuming kl.
|
|
1235
|
-
pos = kl.
|
|
1323
|
+
# (Assuming kl.kececi_layout is the main/generic function)
|
|
1324
|
+
pos = kl.kececi_layout(G,
|
|
1236
1325
|
primary_spacing=1.0,
|
|
1237
1326
|
secondary_spacing=0.5,
|
|
1238
1327
|
primary_direction='top_down',
|
|
@@ -1257,7 +1346,7 @@ try:
|
|
|
1257
1346
|
import kececilayout as kl
|
|
1258
1347
|
except ImportError:
|
|
1259
1348
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
1260
|
-
print("Please ensure the file containing
|
|
1349
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
1261
1350
|
exit()
|
|
1262
1351
|
|
|
1263
1352
|
# --- General Layout Parameters ---
|
|
@@ -1281,7 +1370,7 @@ try:
|
|
|
1281
1370
|
# Calculate layout
|
|
1282
1371
|
print("Calculating Keçeci Layout...")
|
|
1283
1372
|
# Call the layout function from the imported module
|
|
1284
|
-
pos_nx = kl.
|
|
1373
|
+
pos_nx = kl.kececi_layout(G_nx, **LAYOUT_PARAMS)
|
|
1285
1374
|
# print("NetworkX positions:", pos_nx) # Debug print if needed
|
|
1286
1375
|
|
|
1287
1376
|
# Plot
|
|
@@ -1320,7 +1409,7 @@ print("\n--- NetworkX Example Finished ---")
|
|
|
1320
1409
|
import igraph as ig
|
|
1321
1410
|
import matplotlib.pyplot as plt
|
|
1322
1411
|
# Assuming a specific function for igraph exists or the generic one handles it
|
|
1323
|
-
from kececilayout import
|
|
1412
|
+
from kececilayout import kececi_layout_igraph # Adjust import if needed
|
|
1324
1413
|
import random
|
|
1325
1414
|
|
|
1326
1415
|
# Create a graph
|
|
@@ -1329,7 +1418,7 @@ for i in range(G.vcount()):
|
|
|
1329
1418
|
G.vs[i]["name"] = f"N{i}"
|
|
1330
1419
|
|
|
1331
1420
|
# Calculate layout positions (returns a list of coords)
|
|
1332
|
-
pos_list =
|
|
1421
|
+
pos_list = kececi_layout_igraph(G,
|
|
1333
1422
|
primary_spacing=1.5,
|
|
1334
1423
|
secondary_spacing=1.0,
|
|
1335
1424
|
primary_direction='left-to-right',
|
|
@@ -1362,7 +1451,7 @@ try:
|
|
|
1362
1451
|
import kececilayout as kl
|
|
1363
1452
|
except ImportError:
|
|
1364
1453
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
1365
|
-
print("Please ensure the file containing
|
|
1454
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
1366
1455
|
exit()
|
|
1367
1456
|
|
|
1368
1457
|
# --- General Layout Parameters ---
|
|
@@ -1386,7 +1475,7 @@ try:
|
|
|
1386
1475
|
# Calculate layout
|
|
1387
1476
|
print("Calculating Keçeci Layout...")
|
|
1388
1477
|
# Call the layout function from the imported module
|
|
1389
|
-
pos_ig = kl.
|
|
1478
|
+
pos_ig = kl.kececi_layout(G_ig, **LAYOUT_PARAMS)
|
|
1390
1479
|
# print("igraph positions (dict):", pos_ig) # Debug print if needed
|
|
1391
1480
|
|
|
1392
1481
|
# Convert positions dict to list ordered by vertex index for ig.plot
|
|
@@ -1455,7 +1544,7 @@ try:
|
|
|
1455
1544
|
import kececilayout as kl
|
|
1456
1545
|
except ImportError:
|
|
1457
1546
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
1458
|
-
print("Please ensure the file containing
|
|
1547
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
1459
1548
|
exit()
|
|
1460
1549
|
|
|
1461
1550
|
# --- General Layout Parameters ---
|
|
@@ -1479,7 +1568,7 @@ try:
|
|
|
1479
1568
|
# Calculate layout
|
|
1480
1569
|
print("Calculating Keçeci Layout...")
|
|
1481
1570
|
# Call the layout function from the imported module
|
|
1482
|
-
pos_rx = kl.
|
|
1571
|
+
pos_rx = kl.kececi_layout(G_rx, **LAYOUT_PARAMS)
|
|
1483
1572
|
# print("Rustworkx positions:", pos_rx) # Debug print if needed
|
|
1484
1573
|
|
|
1485
1574
|
# Plot using Matplotlib directly (Rustworkx doesn't have a built-in draw)
|
|
@@ -1551,7 +1640,7 @@ try:
|
|
|
1551
1640
|
import kececilayout as kl
|
|
1552
1641
|
except ImportError:
|
|
1553
1642
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
1554
|
-
print("Please ensure the file containing
|
|
1643
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
1555
1644
|
exit()
|
|
1556
1645
|
|
|
1557
1646
|
# --- General Layout Parameters ---
|
|
@@ -1584,7 +1673,7 @@ try:
|
|
|
1584
1673
|
# Calculate layout
|
|
1585
1674
|
print("Calculating Keçeci Layout...")
|
|
1586
1675
|
# Call the layout function from the imported module
|
|
1587
|
-
pos_nk = kl.
|
|
1676
|
+
pos_nk = kl.kececi_layout(G_nk, **LAYOUT_PARAMS)
|
|
1588
1677
|
# print("Networkit positions:", pos_nk) # Debug print if needed
|
|
1589
1678
|
|
|
1590
1679
|
# Plot using Matplotlib directly (Networkit doesn't have a simple built-in draw)
|
|
@@ -1656,7 +1745,7 @@ try:
|
|
|
1656
1745
|
import kececilayout as kl
|
|
1657
1746
|
except ImportError:
|
|
1658
1747
|
print("Error: 'kececi_layout.py' not found or could not be imported.")
|
|
1659
|
-
print("Please ensure the file containing
|
|
1748
|
+
print("Please ensure the file containing kececi_layout is accessible.")
|
|
1660
1749
|
exit()
|
|
1661
1750
|
|
|
1662
1751
|
# --- General Layout Parameters ---
|
|
@@ -1690,7 +1779,7 @@ try:
|
|
|
1690
1779
|
print("Calculating Keçeci Layout...")
|
|
1691
1780
|
# Call the layout function; it should handle the Graphillion GraphSet object
|
|
1692
1781
|
# and likely use 1-based indexing based on the universe.
|
|
1693
|
-
pos_gg = kl.
|
|
1782
|
+
pos_gg = kl.kececi_layout(gs, **LAYOUT_PARAMS)
|
|
1694
1783
|
# print("Graphillion positions:", pos_gg) # Debug print if needed
|
|
1695
1784
|
|
|
1696
1785
|
# Plot using Matplotlib directly (Graphillion has no plotting)
|
|
@@ -1772,8 +1861,8 @@ This project is licensed under the MIT License. See the `LICENSE` file for detai
|
|
|
1772
1861
|
|
|
1773
1862
|
* **Rozetler (Badges):** Başlangıçta PyPI ve Lisans rozetleri ekledim (yorum satırı içinde). Eğer projeniz PyPI'da yayınlandıysa veya bir CI/CD süreci varsa, ilgili rozetleri eklemek iyi bir pratiktir.
|
|
1774
1863
|
* **LICENSE Dosyası:** `LICENSE` bölümünde bir `LICENSE` dosyasına referans verdim. Projenizin kök dizininde MIT lisans metnini içeren bir `LICENSE` dosyası oluşturduğunuzdan emin olun.
|
|
1775
|
-
* **İçe Aktarma Yolları:** Örneklerde `import kececilayout as kl` veya `from kececilayout import
|
|
1776
|
-
* **Fonksiyon Adları:** Örneklerde `
|
|
1864
|
+
* **İçe Aktarma Yolları:** Örneklerde `import kececilayout as kl` veya `from kececilayout import kececi_layout_igraph` gibi varsayımsal içe aktarma yolları kullandım. Kendi paket yapınıza göre bunları ayarlamanız gerekebilir.
|
|
1865
|
+
* **Fonksiyon Adları:** Örneklerde `kececi_layout` ve `kececi_layout_igraph` gibi fonksiyon adlarını kullandım. Gerçek fonksiyon adlarınız farklıysa bunları güncelleyin.
|
|
1777
1866
|
* **Görselleştirme:** Örneklere `matplotlib.pyplot` kullanarak temel görselleştirme adımlarını ekledim, bu da kullanıcıların sonucu nasıl görebileceğini gösterir. Eksen oranlarını eşitlemek (`axis('equal')` veya `set_aspect('equal')`) layout'un doğru görünmesi için önemlidir.
|
|
1778
1867
|
```
|
|
1779
1868
|
|
|
@@ -1810,6 +1899,8 @@ If this library was useful to you in your research, please cite us. Following th
|
|
|
1810
1899
|
|
|
1811
1900
|
```
|
|
1812
1901
|
|
|
1902
|
+
Keçeci, M. (2025). From Chaos to Clarity: The Keçeci Layout for Order-Dependent Systems. https://doi.org/10.5281/zenodo.17665770
|
|
1903
|
+
|
|
1813
1904
|
Keçeci, M. (2025). Deterministic Visualization of Distribution Power Grids: Integration of Power Grid Model and Keçeci Layout. Open Science Articles (OSAs), Zenodo. https://doi.org/10.5281/zenodo.16934620
|
|
1814
1905
|
|
|
1815
1906
|
Keçeci, M. (2025). Graf Teorisi Eğitiminde Yeni Bir Araç: Z3 ve Keçeci Dizilimi ile Hamilton Probleminin İnteraktif Keşfi. Open Science Articles (OSAs), Zenodo. https://doi.org/10.5281/zenodo.16883657
|
|
@@ -1849,6 +1940,7 @@ Keçeci, M. (2025, May 1). Kececilayout. Open Science Articles (OSAs), Zenodo. h
|
|
|
1849
1940
|
### Chicago
|
|
1850
1941
|
|
|
1851
1942
|
```
|
|
1943
|
+
Keçeci, Mehmet. From Chaos to Clarity: The Keçeci Layout for Order-Dependent Systems, November 20, 2025. https://doi.org/10.5281/zenodo.17665770.
|
|
1852
1944
|
|
|
1853
1945
|
Keçeci, Mehmet. The Keçeci Layout: A Deterministic Visualisation Framework for the Structural Analysis of Ordered Systems in Chemistry and Environmental Science. Open Science Articles (OSAs), Zenodo, 2025. https://doi.org/10.5281/zenodo.16696713
|
|
1854
1946
|
|
|
@@ -1860,3 +1952,9 @@ Keçeci, Mehmet. "Kececilayout". Open Science Articles (OSAs), Zenodo, 2025. htt
|
|
|
1860
1952
|
|
|
1861
1953
|
Keçeci, Mehmet. "Keçeci Layout". Open Science Articles (OSAs), Zenodo, 2025. https://doi.org/10.5281/zenodo.15314328.
|
|
1862
1954
|
```
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
kececilayout/__init__.py,sha256=VM2hhmuLnYzUOdqnfUfcCMcVAhqKoVoXGZt2Ap8h28s,4326
|
|
2
|
+
kececilayout/_version.py,sha256=54IUq7pRz3f5rBBN6EesT1JcujcF098oxzUoIsv0ndM,817
|
|
3
|
+
kececilayout/kececi_layout.py,sha256=J0Clc_5Fx6m-pgYDnH-1oJOCrkCaNWjhsbmYQfdjiDo,73849
|
|
4
|
+
kececilayout-0.4.8.dist-info/licenses/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
|
|
5
|
+
kececilayout-0.4.8.dist-info/METADATA,sha256=t80Ur9d2diwL_JnGggU6FRWcNlHX6vD3th-n5iIXP-4,75894
|
|
6
|
+
kececilayout-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
kececilayout-0.4.8.dist-info/top_level.txt,sha256=OBzN_wm4q-iwSkeACF4E8ET_LFLJKBTldSH3D1jG2hA,13
|
|
8
|
+
kececilayout-0.4.8.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
kececilayout/__init__.py,sha256=12AicnQi8b_Jmt4hOX2Mq64tuTAHGjv0dg2zcGKg4_s,4232
|
|
2
|
-
kececilayout/_version.py,sha256=qazsUuV6VwMVMYALTU44NoxJ7cG56PeQa1wjflwKaBk,813
|
|
3
|
-
kececilayout/kececi_layout.py,sha256=mUVoZJr0w7fSlZyY03diD4kA0KOdO6qAfWP9nKIKnhM,66598
|
|
4
|
-
kececilayout-0.4.6.dist-info/licenses/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
|
|
5
|
-
kececilayout-0.4.6.dist-info/METADATA,sha256=Fi31dZrwdXKwrh7byGQgrgee_gRIc854HAFWuMeBpm4,73243
|
|
6
|
-
kececilayout-0.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
kececilayout-0.4.6.dist-info/top_level.txt,sha256=OBzN_wm4q-iwSkeACF4E8ET_LFLJKBTldSH3D1jG2hA,13
|
|
8
|
-
kececilayout-0.4.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|