kececilayout 0.5.7__py3-none-any.whl → 0.5.9__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 -1
- kececilayout/_version.py +1 -1
- kececilayout/kececi_layout.py +363 -6
- {kececilayout-0.5.7.dist-info → kececilayout-0.5.9.dist-info}/METADATA +1 -1
- kececilayout-0.5.9.dist-info/RECORD +10 -0
- tests/test_sample.py +2 -0
- kececilayout-0.5.7.dist-info/RECORD +0 -10
- {kececilayout-0.5.7.dist-info → kececilayout-0.5.9.dist-info}/WHEEL +0 -0
- {kececilayout-0.5.7.dist-info → kececilayout-0.5.9.dist-info}/licenses/LICENSE +0 -0
- {kececilayout-0.5.7.dist-info → kececilayout-0.5.9.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.5.
|
|
13
|
+
__version__ = "0.5.9"
|
|
14
14
|
|
|
15
15
|
# =============================================================================
|
|
16
16
|
# OTOMATİK İÇE AKTARMA VE __all__ OLUŞTURMA
|
|
@@ -67,6 +67,7 @@ from .kececi_layout import ( # Veya fonksiyonların bulunduğu asıl modül
|
|
|
67
67
|
count_edge_crossings,
|
|
68
68
|
generate_complete_periodic_table,
|
|
69
69
|
load_element_data_from_python_dict,
|
|
70
|
+
draw_kececi_custom_labels,
|
|
70
71
|
|
|
71
72
|
# Drawing functions
|
|
72
73
|
draw_kececi,
|
|
@@ -125,6 +126,7 @@ __all__ = [
|
|
|
125
126
|
'count_edge_crossings',
|
|
126
127
|
'generate_complete_periodic_table',
|
|
127
128
|
'load_element_data_from_python_dict',
|
|
129
|
+
'draw_kececi_custom_labels',
|
|
128
130
|
|
|
129
131
|
# Drawing functions
|
|
130
132
|
'draw_kececi',
|
|
@@ -182,3 +184,5 @@ def old_function_placeholder():
|
|
|
182
184
|
|
|
183
185
|
|
|
184
186
|
|
|
187
|
+
|
|
188
|
+
|
kececilayout/_version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _version.py
|
|
2
2
|
|
|
3
|
-
__version__ = "0.5.
|
|
3
|
+
__version__ = "0.5.9"
|
|
4
4
|
__license__ = "AGPL3.0-or-later"
|
|
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"
|
kececilayout/kececi_layout.py
CHANGED
|
@@ -34,8 +34,10 @@ import networkit as nk
|
|
|
34
34
|
import networkx as nx
|
|
35
35
|
import numpy as np # rustworkx
|
|
36
36
|
from numba import jit
|
|
37
|
+
import os
|
|
37
38
|
import platform # graph_tool için
|
|
38
39
|
import random
|
|
40
|
+
import re
|
|
39
41
|
import rustworkx as rx
|
|
40
42
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
41
43
|
import warnings
|
|
@@ -2083,6 +2085,148 @@ def kececi_layout_toric(
|
|
|
2083
2085
|
return pos_3d
|
|
2084
2086
|
|
|
2085
2087
|
# Ağırlıklı Çizim (draw_kececi_weighted)
|
|
2088
|
+
def draw_kececi_weighted(
|
|
2089
|
+
nx_graph: nx.Graph,
|
|
2090
|
+
pos: Dict[int, Tuple[float, ...]],
|
|
2091
|
+
ax: Optional[plt.Axes] = None,
|
|
2092
|
+
node_size: int = 300,
|
|
2093
|
+
edge_width_scale: float = 2.0,
|
|
2094
|
+
with_labels: bool = True,
|
|
2095
|
+
font_weight: str = 'bold',
|
|
2096
|
+
**kwargs
|
|
2097
|
+
) -> plt.Axes:
|
|
2098
|
+
"""
|
|
2099
|
+
2D/3D Weighted edges ile Keçeci layout çizimi.
|
|
2100
|
+
"""
|
|
2101
|
+
if ax is None:
|
|
2102
|
+
# 2D mi 3D mi kontrol et
|
|
2103
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2104
|
+
fig = plt.figure(figsize=(10, 8))
|
|
2105
|
+
if is_3d:
|
|
2106
|
+
ax = fig.add_subplot(111, projection='3d')
|
|
2107
|
+
else:
|
|
2108
|
+
ax = fig.add_subplot(111)
|
|
2109
|
+
|
|
2110
|
+
# Node'ları çiz
|
|
2111
|
+
node_color = kwargs.get('node_color', 'lightblue')
|
|
2112
|
+
nx.draw_networkx_nodes(nx_graph, pos, ax=ax, node_size=node_size,
|
|
2113
|
+
node_color=node_color, **kwargs)
|
|
2114
|
+
|
|
2115
|
+
# Etiketleri çiz
|
|
2116
|
+
if with_labels:
|
|
2117
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2118
|
+
if is_3d:
|
|
2119
|
+
# 3D için özel etiket çizimi
|
|
2120
|
+
for node, coord in pos.items():
|
|
2121
|
+
ax.text(coord[0], coord[1], coord[2], # 3D koordinatlar
|
|
2122
|
+
str(node), # 's' parametresi - etiket metni
|
|
2123
|
+
size=10,
|
|
2124
|
+
zorder=1,
|
|
2125
|
+
color='black',
|
|
2126
|
+
fontweight=font_weight)
|
|
2127
|
+
else:
|
|
2128
|
+
# 2D için NetworkX etiket çizimi
|
|
2129
|
+
nx.draw_networkx_labels(nx_graph, pos, ax=ax, font_weight=font_weight)
|
|
2130
|
+
|
|
2131
|
+
# Edge'leri çiz (weight'e göre)
|
|
2132
|
+
weights = nx.get_edge_attributes(nx_graph, 'weight')
|
|
2133
|
+
if not weights:
|
|
2134
|
+
weights = {edge: 1.0 for edge in nx_graph.edges()}
|
|
2135
|
+
|
|
2136
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2137
|
+
for (u, v), weight in weights.items():
|
|
2138
|
+
width = weight * edge_width_scale
|
|
2139
|
+
if is_3d:
|
|
2140
|
+
# 3D edge çizimi
|
|
2141
|
+
ax.plot(
|
|
2142
|
+
[pos[u][0], pos[v][0]],
|
|
2143
|
+
[pos[u][1], pos[v][1]],
|
|
2144
|
+
[pos[u][2], pos[v][2]],
|
|
2145
|
+
linewidth=width,
|
|
2146
|
+
color='gray',
|
|
2147
|
+
alpha=0.7
|
|
2148
|
+
)
|
|
2149
|
+
else:
|
|
2150
|
+
# 2D edge çizimi
|
|
2151
|
+
ax.plot(
|
|
2152
|
+
[pos[u][0], pos[v][0]],
|
|
2153
|
+
[pos[u][1], pos[v][1]],
|
|
2154
|
+
linewidth=width,
|
|
2155
|
+
color='gray',
|
|
2156
|
+
alpha=0.7
|
|
2157
|
+
)
|
|
2158
|
+
|
|
2159
|
+
ax.set_title("Keçeci Layout: Weighted Edges")
|
|
2160
|
+
return ax
|
|
2161
|
+
|
|
2162
|
+
def draw_kececi_colored(
|
|
2163
|
+
nx_graph: nx.Graph,
|
|
2164
|
+
pos: Dict[int, Tuple[float, ...]],
|
|
2165
|
+
ax: Optional[plt.Axes] = None,
|
|
2166
|
+
node_size: int = 300,
|
|
2167
|
+
with_labels: bool = True,
|
|
2168
|
+
font_weight: str = 'bold',
|
|
2169
|
+
**kwargs
|
|
2170
|
+
) -> plt.Axes:
|
|
2171
|
+
"""
|
|
2172
|
+
2D/3D Renkli node'lar ile Keçeci layout çizimi.
|
|
2173
|
+
"""
|
|
2174
|
+
if ax is None:
|
|
2175
|
+
# 2D mi 3D mi kontrol et
|
|
2176
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2177
|
+
fig = plt.figure(figsize=(10, 8))
|
|
2178
|
+
if is_3d:
|
|
2179
|
+
ax = fig.add_subplot(111, projection='3d')
|
|
2180
|
+
else:
|
|
2181
|
+
ax = fig.add_subplot(111)
|
|
2182
|
+
|
|
2183
|
+
# Dereceye göre renk hesapla
|
|
2184
|
+
degrees = dict(nx_graph.degree())
|
|
2185
|
+
max_degree = max(degrees.values()) if degrees else 1
|
|
2186
|
+
node_colors = [plt.cm.viridis(deg / max_degree) for deg in degrees.values()]
|
|
2187
|
+
|
|
2188
|
+
# Node'ları çiz
|
|
2189
|
+
nx.draw_networkx_nodes(
|
|
2190
|
+
nx_graph, pos, ax=ax,
|
|
2191
|
+
node_color=node_colors,
|
|
2192
|
+
node_size=node_size,
|
|
2193
|
+
**kwargs
|
|
2194
|
+
)
|
|
2195
|
+
|
|
2196
|
+
# Etiketleri çiz
|
|
2197
|
+
if with_labels:
|
|
2198
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2199
|
+
if is_3d:
|
|
2200
|
+
# 3D için özel etiket çizimi
|
|
2201
|
+
for node, coord in pos.items():
|
|
2202
|
+
ax.text(coord[0], coord[1], coord[2], # 3D koordinatlar
|
|
2203
|
+
str(node), # 's' parametresi - etiket metni
|
|
2204
|
+
size=10,
|
|
2205
|
+
zorder=1,
|
|
2206
|
+
color='black',
|
|
2207
|
+
fontweight=font_weight)
|
|
2208
|
+
else:
|
|
2209
|
+
# 2D için NetworkX etiket çizimi
|
|
2210
|
+
nx.draw_networkx_labels(nx_graph, pos, ax=ax, font_weight=font_weight)
|
|
2211
|
+
|
|
2212
|
+
# Edge'leri çiz
|
|
2213
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2214
|
+
if is_3d:
|
|
2215
|
+
for u, v in nx_graph.edges():
|
|
2216
|
+
ax.plot(
|
|
2217
|
+
[pos[u][0], pos[v][0]],
|
|
2218
|
+
[pos[u][1], pos[v][1]],
|
|
2219
|
+
[pos[u][2], pos[v][2]],
|
|
2220
|
+
color='gray',
|
|
2221
|
+
alpha=0.5
|
|
2222
|
+
)
|
|
2223
|
+
else:
|
|
2224
|
+
nx.draw_networkx_edges(nx_graph, pos, ax=ax, alpha=0.5)
|
|
2225
|
+
|
|
2226
|
+
ax.set_title("Keçeci Layout: Colored Nodes")
|
|
2227
|
+
return ax
|
|
2228
|
+
|
|
2229
|
+
"""
|
|
2086
2230
|
def draw_kececi_weighted(
|
|
2087
2231
|
nx_graph: nx.Graph,
|
|
2088
2232
|
pos: Dict[int, Tuple[float, ...]],
|
|
@@ -2130,7 +2274,8 @@ def draw_kececi_weighted(
|
|
|
2130
2274
|
|
|
2131
2275
|
ax.set_title("Keçeci Layout: Weighted Edges")
|
|
2132
2276
|
return ax
|
|
2133
|
-
|
|
2277
|
+
"""
|
|
2278
|
+
"""
|
|
2134
2279
|
# Renkli Çizim (draw_kececi_colored)
|
|
2135
2280
|
def draw_kececi_colored(
|
|
2136
2281
|
nx_graph: nx.Graph,
|
|
@@ -2175,6 +2320,7 @@ def draw_kececi_colored(
|
|
|
2175
2320
|
|
|
2176
2321
|
ax.set_title("Keçeci Layout: Colored Nodes")
|
|
2177
2322
|
return ax
|
|
2323
|
+
"""
|
|
2178
2324
|
|
|
2179
2325
|
# =============================================================================
|
|
2180
2326
|
# 3. INTERNAL DRAWING STYLE IMPLEMENTATIONS
|
|
@@ -2286,13 +2432,16 @@ def draw_kececi(
|
|
|
2286
2432
|
style: str = 'default',
|
|
2287
2433
|
ax: Optional[plt.Axes] = None,
|
|
2288
2434
|
with_labels: bool = True,
|
|
2289
|
-
node_color: str = 'lightblue',
|
|
2435
|
+
node_color: Union[str, List] = 'lightblue',
|
|
2290
2436
|
node_size: int = 500,
|
|
2291
2437
|
font_weight: str = 'bold',
|
|
2438
|
+
edge_color: str = 'gray',
|
|
2439
|
+
edge_alpha: float = 0.5,
|
|
2440
|
+
edge_width: float = 1.0,
|
|
2292
2441
|
**kwargs
|
|
2293
2442
|
) -> plt.Axes:
|
|
2294
2443
|
"""
|
|
2295
|
-
Keçeci Layout ile graf çizimi.
|
|
2444
|
+
Keçeci Layout ile 2D/3D uyumlu graf çizimi.
|
|
2296
2445
|
|
|
2297
2446
|
Args:
|
|
2298
2447
|
graph: Graf objesi (NetworkX, igraph, vb.).
|
|
@@ -2301,9 +2450,12 @@ def draw_kececi(
|
|
|
2301
2450
|
style: 'default', 'weighted', 'colored'.
|
|
2302
2451
|
ax: Matplotlib ekseni.
|
|
2303
2452
|
with_labels: Düğüm etiketlerini göster.
|
|
2304
|
-
node_color: Düğüm rengi.
|
|
2453
|
+
node_color: Düğüm rengi (tek renk veya renk listesi).
|
|
2305
2454
|
node_size: Düğüm boyutu.
|
|
2306
2455
|
font_weight: Yazı kalınlığı.
|
|
2456
|
+
edge_color: Kenar rengi.
|
|
2457
|
+
edge_alpha: Kenar şeffaflığı.
|
|
2458
|
+
edge_width: Kenar kalınlığı.
|
|
2307
2459
|
**kwargs: Ek parametreler.
|
|
2308
2460
|
|
|
2309
2461
|
Returns:
|
|
@@ -2311,6 +2463,209 @@ def draw_kececi(
|
|
|
2311
2463
|
"""
|
|
2312
2464
|
nx_graph = to_networkx(graph)
|
|
2313
2465
|
|
|
2466
|
+
# Eğer pos verilmemişse, layout'a göre hesapla
|
|
2467
|
+
if pos is None:
|
|
2468
|
+
if layout is None:
|
|
2469
|
+
layout = '2d' # Varsayılan layout
|
|
2470
|
+
|
|
2471
|
+
if layout == '2d':
|
|
2472
|
+
pos = kececi_layout_2d(nx_graph, **kwargs)
|
|
2473
|
+
elif layout == 'cylindrical':
|
|
2474
|
+
pos = kececi_layout_cylindrical(nx_graph, **kwargs)
|
|
2475
|
+
elif layout == 'cubic':
|
|
2476
|
+
pos = kececi_layout_cubic(nx_graph, **kwargs)
|
|
2477
|
+
elif layout == 'spherical':
|
|
2478
|
+
pos = kececi_layout_spherical(nx_graph, **kwargs)
|
|
2479
|
+
elif layout == 'elliptical':
|
|
2480
|
+
pos = kececi_layout_elliptical(nx_graph, **kwargs)
|
|
2481
|
+
elif layout == 'toric':
|
|
2482
|
+
pos = kececi_layout_toric(nx_graph, **kwargs)
|
|
2483
|
+
else:
|
|
2484
|
+
raise ValueError(f"Geçersiz layout: {layout}")
|
|
2485
|
+
|
|
2486
|
+
# 2D mi 3D mi kontrol et
|
|
2487
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2488
|
+
|
|
2489
|
+
# Eksen oluştur (eğer verilmemişse)
|
|
2490
|
+
if ax is None:
|
|
2491
|
+
fig = plt.figure(figsize=(10, 8))
|
|
2492
|
+
if is_3d:
|
|
2493
|
+
ax = fig.add_subplot(111, projection='3d')
|
|
2494
|
+
else:
|
|
2495
|
+
ax = fig.add_subplot(111)
|
|
2496
|
+
|
|
2497
|
+
# Stile göre çizim yap
|
|
2498
|
+
if style == 'weighted':
|
|
2499
|
+
draw_kececi_weighted(nx_graph, pos, ax, node_size=node_size,
|
|
2500
|
+
with_labels=with_labels, font_weight=font_weight, **kwargs)
|
|
2501
|
+
elif style == 'colored':
|
|
2502
|
+
draw_kececi_colored(nx_graph, pos, ax, node_size=node_size,
|
|
2503
|
+
with_labels=with_labels, font_weight=font_weight, **kwargs)
|
|
2504
|
+
else: # 'default'
|
|
2505
|
+
# Node'ları çiz
|
|
2506
|
+
nx.draw_networkx_nodes(nx_graph, pos, ax=ax,
|
|
2507
|
+
node_color=node_color,
|
|
2508
|
+
node_size=node_size,
|
|
2509
|
+
**kwargs)
|
|
2510
|
+
|
|
2511
|
+
# Etiketleri çiz
|
|
2512
|
+
if with_labels:
|
|
2513
|
+
if is_3d:
|
|
2514
|
+
# 3D için özel etiket çizimi
|
|
2515
|
+
for node, coord in pos.items():
|
|
2516
|
+
ax.text(coord[0], coord[1], coord[2], # 3D koordinatlar
|
|
2517
|
+
str(node), # 's' parametresi - etiket metni
|
|
2518
|
+
size=10,
|
|
2519
|
+
zorder=1,
|
|
2520
|
+
color='black',
|
|
2521
|
+
fontweight=font_weight,
|
|
2522
|
+
ha='center', # Yatayda ortala
|
|
2523
|
+
va='center') # Dikeyde ortala
|
|
2524
|
+
else:
|
|
2525
|
+
# 2D için NetworkX etiket çizimi
|
|
2526
|
+
nx.draw_networkx_labels(nx_graph, pos, ax=ax, font_weight=font_weight)
|
|
2527
|
+
|
|
2528
|
+
# Edge'leri çiz
|
|
2529
|
+
if is_3d:
|
|
2530
|
+
for u, v in nx_graph.edges():
|
|
2531
|
+
ax.plot(
|
|
2532
|
+
[pos[u][0], pos[v][0]],
|
|
2533
|
+
[pos[u][1], pos[v][1]],
|
|
2534
|
+
[pos[u][2], pos[v][2]],
|
|
2535
|
+
color=edge_color,
|
|
2536
|
+
alpha=edge_alpha,
|
|
2537
|
+
linewidth=edge_width
|
|
2538
|
+
)
|
|
2539
|
+
else:
|
|
2540
|
+
nx.draw_networkx_edges(nx_graph, pos, ax=ax,
|
|
2541
|
+
alpha=edge_alpha,
|
|
2542
|
+
edge_color=edge_color,
|
|
2543
|
+
width=edge_width)
|
|
2544
|
+
|
|
2545
|
+
title = f"Keçeci Layout: {layout.capitalize() if layout else 'Custom'} ({style})"
|
|
2546
|
+
ax.set_title(title)
|
|
2547
|
+
|
|
2548
|
+
# Eksenleri kapat
|
|
2549
|
+
ax.set_axis_off()
|
|
2550
|
+
|
|
2551
|
+
return ax
|
|
2552
|
+
|
|
2553
|
+
def draw_kececi_custom_labels(
|
|
2554
|
+
graph,
|
|
2555
|
+
pos: Dict[int, Tuple[float, ...]],
|
|
2556
|
+
labels: Dict[int, str],
|
|
2557
|
+
ax: Optional[plt.Axes] = None,
|
|
2558
|
+
node_size: int = 500,
|
|
2559
|
+
node_color: Union[str, List] = 'lightblue',
|
|
2560
|
+
font_size: int = 10,
|
|
2561
|
+
font_color: Union[str, List] = 'black',
|
|
2562
|
+
font_weight: str = 'bold',
|
|
2563
|
+
**kwargs
|
|
2564
|
+
) -> plt.Axes:
|
|
2565
|
+
"""
|
|
2566
|
+
Özel etiketlerle Keçeci layout çizimi (2D/3D uyumlu).
|
|
2567
|
+
|
|
2568
|
+
Args:
|
|
2569
|
+
graph: Graf objesi
|
|
2570
|
+
pos: Node pozisyonları
|
|
2571
|
+
labels: Özel etiketler (node_id: label_text)
|
|
2572
|
+
ax: Matplotlib ekseni
|
|
2573
|
+
node_size: Node boyutu
|
|
2574
|
+
node_color: Node rengi
|
|
2575
|
+
font_size: Yazı boyutu
|
|
2576
|
+
font_color: Yazı rengi
|
|
2577
|
+
font_weight: Yazı kalınlığı
|
|
2578
|
+
**kwargs: Ek parametreler
|
|
2579
|
+
|
|
2580
|
+
Returns:
|
|
2581
|
+
Matplotlib ekseni
|
|
2582
|
+
"""
|
|
2583
|
+
nx_graph = to_networkx(graph)
|
|
2584
|
+
|
|
2585
|
+
# 2D mi 3D mi kontrol et
|
|
2586
|
+
is_3d = len(pos[next(iter(pos))]) == 3
|
|
2587
|
+
|
|
2588
|
+
# Eksen oluştur (eğer verilmemişse)
|
|
2589
|
+
if ax is None:
|
|
2590
|
+
fig = plt.figure(figsize=(10, 8))
|
|
2591
|
+
if is_3d:
|
|
2592
|
+
ax = fig.add_subplot(111, projection='3d')
|
|
2593
|
+
else:
|
|
2594
|
+
ax = fig.add_subplot(111)
|
|
2595
|
+
|
|
2596
|
+
# Node'ları çiz
|
|
2597
|
+
nx.draw_networkx_nodes(nx_graph, pos, ax=ax,
|
|
2598
|
+
node_color=node_color,
|
|
2599
|
+
node_size=node_size,
|
|
2600
|
+
**kwargs)
|
|
2601
|
+
|
|
2602
|
+
# Edge'leri çiz
|
|
2603
|
+
if is_3d:
|
|
2604
|
+
for u, v in nx_graph.edges():
|
|
2605
|
+
ax.plot(
|
|
2606
|
+
[pos[u][0], pos[v][0]],
|
|
2607
|
+
[pos[u][1], pos[v][1]],
|
|
2608
|
+
[pos[u][2], pos[v][2]],
|
|
2609
|
+
color='gray',
|
|
2610
|
+
alpha=0.5
|
|
2611
|
+
)
|
|
2612
|
+
else:
|
|
2613
|
+
nx.draw_networkx_edges(nx_graph, pos, ax=ax, alpha=0.5)
|
|
2614
|
+
|
|
2615
|
+
# Özel etiketleri çiz
|
|
2616
|
+
if is_3d:
|
|
2617
|
+
for node, coord in pos.items():
|
|
2618
|
+
if node in labels:
|
|
2619
|
+
ax.text(coord[0], coord[1], coord[2],
|
|
2620
|
+
labels[node],
|
|
2621
|
+
fontsize=font_size,
|
|
2622
|
+
fontweight=font_weight,
|
|
2623
|
+
color=font_color if isinstance(font_color, str) else font_color[node-1],
|
|
2624
|
+
ha='center',
|
|
2625
|
+
va='center',
|
|
2626
|
+
zorder=10)
|
|
2627
|
+
else:
|
|
2628
|
+
# 2D için NetworkX etiket çizimi
|
|
2629
|
+
nx.draw_networkx_labels(nx_graph, pos, labels=labels, ax=ax,
|
|
2630
|
+
font_size=font_size,
|
|
2631
|
+
font_color=font_color,
|
|
2632
|
+
font_weight=font_weight)
|
|
2633
|
+
|
|
2634
|
+
ax.set_title("Keçeci Layout with Custom Labels")
|
|
2635
|
+
ax.set_axis_off()
|
|
2636
|
+
|
|
2637
|
+
return ax
|
|
2638
|
+
"""
|
|
2639
|
+
def draw_kececi(
|
|
2640
|
+
graph,
|
|
2641
|
+
pos: Optional[Dict[int, Tuple[float, ...]]] = None,
|
|
2642
|
+
layout: Optional[str] = None,
|
|
2643
|
+
style: str = 'default',
|
|
2644
|
+
ax: Optional[plt.Axes] = None,
|
|
2645
|
+
with_labels: bool = True,
|
|
2646
|
+
node_color: str = 'lightblue',
|
|
2647
|
+
node_size: int = 500,
|
|
2648
|
+
font_weight: str = 'bold',
|
|
2649
|
+
**kwargs
|
|
2650
|
+
) -> plt.Axes:
|
|
2651
|
+
|
|
2652
|
+
Keçeci Layout ile graf çizimi.
|
|
2653
|
+
Args:
|
|
2654
|
+
graph: Graf objesi (NetworkX, igraph, vb.).
|
|
2655
|
+
pos: Önceden hesaplanmış koordinatlar (opsiyonel).
|
|
2656
|
+
layout: '2d', 'cylindrical', 'cubic', 'spherical', 'elliptical', 'toric' (opsiyonel).
|
|
2657
|
+
style: 'default', 'weighted', 'colored'.
|
|
2658
|
+
ax: Matplotlib ekseni.
|
|
2659
|
+
with_labels: Düğüm etiketlerini göster.
|
|
2660
|
+
node_color: Düğüm rengi.
|
|
2661
|
+
node_size: Düğüm boyutu.
|
|
2662
|
+
font_weight: Yazı kalınlığı.
|
|
2663
|
+
**kwargs: Ek parametreler.
|
|
2664
|
+
Returns:
|
|
2665
|
+
Matplotlib ekseni.
|
|
2666
|
+
|
|
2667
|
+
nx_graph = to_networkx(graph)
|
|
2668
|
+
|
|
2314
2669
|
# Eğer pos verilmemişse, layout'a göre hesapla
|
|
2315
2670
|
if pos is None:
|
|
2316
2671
|
if layout is None:
|
|
@@ -2372,6 +2727,7 @@ def draw_kececi(
|
|
|
2372
2727
|
ax.set_title(f"Keçeci Layout: {layout.capitalize() if layout else 'Custom'} ({style})")
|
|
2373
2728
|
return ax
|
|
2374
2729
|
"""
|
|
2730
|
+
"""
|
|
2375
2731
|
def draw_kececi(
|
|
2376
2732
|
graph,
|
|
2377
2733
|
layout: str = '2d',
|
|
@@ -2381,14 +2737,12 @@ def draw_kececi(
|
|
|
2381
2737
|
) -> plt.Axes:
|
|
2382
2738
|
|
|
2383
2739
|
Keçeci Layout ile graf çizimi.
|
|
2384
|
-
|
|
2385
2740
|
Args:
|
|
2386
2741
|
graph: Graf objesi (NetworkX, igraph, vb.).
|
|
2387
2742
|
layout: '2d', 'cylindrical', 'cubic', 'spherical', 'elliptical', 'toric'.
|
|
2388
2743
|
style: 'default', 'weighted', 'colored'.
|
|
2389
2744
|
ax: Matplotlib ekseni.
|
|
2390
2745
|
**kwargs: Ek parametreler.
|
|
2391
|
-
|
|
2392
2746
|
Returns:
|
|
2393
2747
|
Matplotlib ekseni.
|
|
2394
2748
|
|
|
@@ -2542,3 +2896,6 @@ if __name__ == '__main__':
|
|
|
2542
2896
|
|
|
2543
2897
|
|
|
2544
2898
|
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
docs/conf.py,sha256=GCnObt4uegIychQdfaWy1ObNytxnf3tvot7PDVZR4mA,2831
|
|
2
|
+
kececilayout/__init__.py,sha256=cQWRW4segxr-WfRTd1LZY1noZxzMORpqDrkFzPV4rQU,5482
|
|
3
|
+
kececilayout/_version.py,sha256=lzMX_soOpDLJ8UumOLH4m5-EUUbXh4mQEb0b7rLRMoc,826
|
|
4
|
+
kececilayout/kececi_layout.py,sha256=h-bCUGnF5SeZ_k9pDxRjfisKbPQjOSoDK-NzWW-Jjbo,123281
|
|
5
|
+
kececilayout-0.5.9.dist-info/licenses/LICENSE,sha256=xdxzt6hFCDi0ssOOl4UK4E8yuf47W_POYGGnBjwkxaM,34518
|
|
6
|
+
tests/test_sample.py,sha256=aVJ7pp3YvzwGrMZADXhi4R-TQDKamb3oTwckBmtE5T0,10784
|
|
7
|
+
kececilayout-0.5.9.dist-info/METADATA,sha256=zzqOvYenzWsilQto8sWnnaU0Ubp0coK2Vho_BQWCCdM,126759
|
|
8
|
+
kececilayout-0.5.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
9
|
+
kececilayout-0.5.9.dist-info/top_level.txt,sha256=BaQiBtdzk9y2bVscER5uJlQqSaXN0Wnyg0rTOnFfbqU,24
|
|
10
|
+
kececilayout-0.5.9.dist-info/RECORD,,
|
tests/test_sample.py
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
docs/conf.py,sha256=GCnObt4uegIychQdfaWy1ObNytxnf3tvot7PDVZR4mA,2831
|
|
2
|
-
kececilayout/__init__.py,sha256=LHUCpadQ03y9iqZZVw8CWsLedkM0rLIxItAG6dE9Diw,5412
|
|
3
|
-
kececilayout/_version.py,sha256=gdI2wv37mIAseVB4SJXuFIWo_vFW28bsjDDfPnUnK88,826
|
|
4
|
-
kececilayout/kececi_layout.py,sha256=6Go3sth_kTcehhrSAEcxtd4ppMv_O-5dTYZSw-J-R1A,111342
|
|
5
|
-
kececilayout-0.5.7.dist-info/licenses/LICENSE,sha256=xdxzt6hFCDi0ssOOl4UK4E8yuf47W_POYGGnBjwkxaM,34518
|
|
6
|
-
tests/test_sample.py,sha256=dDwjPZyVH5GEOHc2WH-Zv8vFHvAKze0iLiH0HCishYI,10764
|
|
7
|
-
kececilayout-0.5.7.dist-info/METADATA,sha256=BLeEV3dZcJMai5gQ_f1IZ5PcVUX6Rd6KdxKMl2viyUE,126759
|
|
8
|
-
kececilayout-0.5.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
9
|
-
kececilayout-0.5.7.dist-info/top_level.txt,sha256=BaQiBtdzk9y2bVscER5uJlQqSaXN0Wnyg0rTOnFfbqU,24
|
|
10
|
-
kececilayout-0.5.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|