kececilayout 0.4.6__tar.gz → 0.4.7__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kececilayout
3
- Version: 0.4.6
3
+ Version: 0.4.7
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_rx, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_nk, **LAYOUT_PARAMS)
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
  ![Networkit Example](https://github.com/WhiteSymmetry/kececilayout/blob/main/examples/nk-1.png?raw=true)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(gs, **LAYOUT_PARAMS)
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
+ ![graph-tool Example](https://github.com/WhiteSymmetry/kececilayout/blob/main/examples/gt-1.png?raw=true)
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 `kececi_layout_v4` function.*
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_ig, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_rx, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_nk, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(gs, **LAYOUT_PARAMS)
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 `kececi_layout_v4` fonksiyonu ile desteklenir.*
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.kececi_layout_v4 is the main/generic function)
1235
- pos = kl.kececi_layout_v4(G,
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_nx, **LAYOUT_PARAMS)
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 kececi_layout_v4_igraph # Adjust import if needed
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 = kececi_layout_v4_igraph(G,
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_ig, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_rx, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(G_nk, **LAYOUT_PARAMS)
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 kececi_layout_v4 is accessible.")
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.kececi_layout_v4(gs, **LAYOUT_PARAMS)
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 kececi_layout_v4_igraph` gibi varsayımsal içe aktarma yolları kullandım. Kendi paket yapınıza göre bunları ayarlamanız gerekebilir.
1776
- * **Fonksiyon Adları:** Örneklerde `kececi_layout_v4` ve `kececi_layout_v4_igraph` gibi fonksiyon adlarını kullandım. Gerçek fonksiyon adlarınız farklıysa bunları güncelleyin.
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
+