differt-core 0.0.12__tar.gz → 0.0.13__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.
Files changed (54) hide show
  1. {differt_core-0.0.12 → differt_core-0.0.13}/Cargo.lock +1 -1
  2. {differt_core-0.0.12 → differt_core-0.0.13}/PKG-INFO +1 -4
  3. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/Cargo.toml +1 -1
  4. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/README.md +0 -3
  5. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/rt/graph.rs +51 -23
  6. {differt_core-0.0.12 → differt_core-0.0.13}/Cargo.toml +0 -0
  7. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/LICENSE.md +0 -0
  8. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/benches/bench_main.rs +0 -0
  9. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/benches/benchmarks/graph_iterators.rs +0 -0
  10. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/benches/benchmarks/mod.rs +0 -0
  11. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/__init__.py +0 -0
  12. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/__init__.pyi +0 -0
  13. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -0
  14. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
  15. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/rt/graph.pyi +0 -0
  16. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/scene/sionna.pyi +0 -0
  17. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -0
  18. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/geometry/__init__.py +0 -0
  19. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/geometry/triangle_mesh.py +0 -0
  20. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/py.typed +0 -0
  21. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/rt/__init__.py +0 -0
  22. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/rt/graph.py +0 -0
  23. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/scene/__init__.py +0 -0
  24. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/scene/sionna.py +0 -0
  25. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/python/differt_core/scene/triangle_scene.py +0 -0
  26. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/geometry/mod.rs +0 -0
  27. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/geometry/triangle_mesh.rs +0 -0
  28. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/lib.rs +0 -0
  29. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/rt/mod.rs +0 -0
  30. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/scene/mod.rs +0 -0
  31. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/scene/sionna.rs +0 -0
  32. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/src/scene/triangle_scene.rs +0 -0
  33. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/__init__.py +0 -0
  34. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/benchmarks/__init__.py +0 -0
  35. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/benchmarks/conftest.py +0 -0
  36. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/benchmarks/test_graph.py +0 -0
  37. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/rt/__init__.py +0 -0
  38. {differt_core-0.0.12 → differt_core-0.0.13}/differt-core/tests/rt/test_graph.py +0 -0
  39. {differt_core-0.0.12 → differt_core-0.0.13}/pyproject.toml +0 -0
  40. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/__init__.py +0 -0
  41. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/__init__.pyi +0 -0
  42. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -0
  43. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
  44. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/rt/graph.pyi +0 -0
  45. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/scene/sionna.pyi +0 -0
  46. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -0
  47. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/geometry/__init__.py +0 -0
  48. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/geometry/triangle_mesh.py +0 -0
  49. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/py.typed +0 -0
  50. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/rt/__init__.py +0 -0
  51. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/rt/graph.py +0 -0
  52. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/scene/__init__.py +0 -0
  53. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/scene/sionna.py +0 -0
  54. {differt_core-0.0.12 → differt_core-0.0.13}/python/differt_core/scene/triangle_scene.py +0 -0
@@ -238,7 +238,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
238
238
 
239
239
  [[package]]
240
240
  name = "differt-core"
241
- version = "0.0.12"
241
+ version = "0.0.13"
242
242
  dependencies = [
243
243
  "criterion",
244
244
  "log",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: differt-core
3
- Version: 0.0.12
3
+ Version: 0.0.13
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.9
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -31,7 +31,6 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
31
31
  [![Latest Release][pypi-version-badge]][pypi-version-url]
32
32
  [![Python version][pypi-python-version-badge]][pypi-version-url]
33
33
  [![Documentation][documentation-badge]][documentation-url]
34
- [![Codecov][codecov-badge]][codecov-url]
35
34
 
36
35
  </div>
37
36
 
@@ -54,6 +53,4 @@ are shared with the
54
53
  [pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/DiffeRT-core?color=orange
55
54
  [documentation-badge]: https://readthedocs.org/projects/differt/badge/?version=latest
56
55
  [documentation-url]: https://differt.readthedocs.io/latest/?badge=latest
57
- [codecov-badge]: https://codecov.io/gh/jeertmans/DiffeRT-core/branch/main/graph/badge.svg?token=8P4DY9JCE4
58
- [codecov-url]: https://codecov.io/gh/jeertmans/DiffeRT-core
59
56
 
@@ -32,4 +32,4 @@ name = "differt_core"
32
32
  edition = "2021"
33
33
  name = "differt-core"
34
34
  rust-version = "1.75.0"
35
- version = "0.0.12"
35
+ version = "0.0.13"
@@ -9,7 +9,6 @@
9
9
  [![Latest Release][pypi-version-badge]][pypi-version-url]
10
10
  [![Python version][pypi-python-version-badge]][pypi-version-url]
11
11
  [![Documentation][documentation-badge]][documentation-url]
12
- [![Codecov][codecov-badge]][codecov-url]
13
12
 
14
13
  </div>
15
14
 
@@ -32,5 +31,3 @@ are shared with the
32
31
  [pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/DiffeRT-core?color=orange
33
32
  [documentation-badge]: https://readthedocs.org/projects/differt/badge/?version=latest
34
33
  [documentation-url]: https://differt.readthedocs.io/latest/?badge=latest
35
- [codecov-badge]: https://codecov.io/gh/jeertmans/DiffeRT-core/branch/main/graph/badge.svg?token=8P4DY9JCE4
36
- [codecov-url]: https://codecov.io/gh/jeertmans/DiffeRT-core
@@ -133,7 +133,7 @@ pub mod complete {
133
133
  }
134
134
 
135
135
  /// Return an iterator over all paths of length ``depth``
136
- /// from node ``from`` to node ``to``.
136
+ /// from node ``from_`` to node ``to``.
137
137
  ///
138
138
  /// .. note::
139
139
  ///
@@ -174,7 +174,7 @@ pub mod complete {
174
174
  /// from\_ (int): The node index to find the paths from.
175
175
  /// to (int): The node index to find the paths to.
176
176
  /// depth (int): The number of nodes to include in each path.
177
- /// include_from_and_to (bool): Whether to include or not ``from``
177
+ /// include_from_and_to (bool): Whether to include or not ``from_``
178
178
  /// and ``to`` nodes in the output paths. If set to
179
179
  /// :py:data:`False`, the output paths will include
180
180
  /// ``depth - 2`` nodes.
@@ -194,13 +194,13 @@ pub mod complete {
194
194
  }
195
195
 
196
196
  /// Return an array of all paths of length ``depth``
197
- /// from node ``from`` to node ``to``.
197
+ /// from node ``from_`` to node ``to``.
198
198
  ///
199
199
  /// Args:
200
200
  /// from\_ (int): The node index to find the paths from.
201
201
  /// to (int): The node index to find the paths to.
202
202
  /// depth (int): The number of nodes to include in each path.
203
- /// include_from_and_to (bool): Whether to include or not ``from``
203
+ /// include_from_and_to (bool): Whether to include or not ``from_``
204
204
  /// and ``to`` nodes in the output paths. If set to
205
205
  /// :py:data:`False`, the output paths will include
206
206
  /// ``depth - 2`` nodes.
@@ -224,14 +224,14 @@ pub mod complete {
224
224
  }
225
225
 
226
226
  /// Return an iterator over all paths of length ``depth``
227
- /// from node ``from`` to node ``to``, grouped in chunks of
227
+ /// from node ``from_`` to node ``to``, grouped in chunks of
228
228
  /// size of max. ``chunk_size``.
229
229
  ///
230
230
  /// Args:
231
231
  /// from\_ (int): The node index to find the paths from.
232
232
  /// to (int): The node index to find the paths to.
233
233
  /// depth (int): The number of nodes to include in each path.
234
- /// include_from_and_to (bool): Whether to include or not ``from``
234
+ /// include_from_and_to (bool): Whether to include or not ``from_``
235
235
  /// and ``to`` nodes in the output paths. If set to
236
236
  /// :py:data:`False`, the output paths will include
237
237
  /// ``depth - 2`` nodes.
@@ -301,9 +301,6 @@ pub mod complete {
301
301
 
302
302
  let mut visited = Vec::with_capacity(depth);
303
303
  let mut counter = Vec::with_capacity(depth);
304
- visited.push(from);
305
- counter.push(graph.num_nodes); // num_nodes means we visited all
306
- // first nodes, because first not is fixed
307
304
 
308
305
  let paths_count = 0;
309
306
  let paths_total_count = match depth.cmp(&2) {
@@ -361,6 +358,14 @@ pub mod complete {
361
358
  },
362
359
  };
363
360
 
361
+ if paths_total_count > 0 {
362
+ // Avoid visiting any node if no path exists
363
+ visited.push(from);
364
+ counter.push(graph.num_nodes);
365
+ // `num_nodes` means we visited all
366
+ // first nodes, because the first node is fixed
367
+ }
368
+
364
369
  Self {
365
370
  graph,
366
371
  to,
@@ -609,19 +614,20 @@ pub mod directed {
609
614
  graph.into()
610
615
  }
611
616
 
612
- /// Insert two additional nodes in the graph:
617
+ /// Insert two additional nodes in the graph: ``from_`` and ``to``.
618
+ ///
619
+ /// The nodes satisfy the following conditions:
613
620
  ///
614
- /// - a ``from`` node, that is connected to every other node in the
615
- /// graph;
616
- /// - and a ``to`` node, where every other node is connected to this
617
- /// node.
621
+ /// - ``from_`` is connected to every other node in the graph;
622
+ /// - and ``to`` is an `endpoint`, where every other node is connected
623
+ /// to this node.
618
624
  ///
619
- /// If ``direct_path`` is :py:data:`True`, then the ``from`` node is
620
- /// connected to the ``to`` node.
625
+ /// If ``direct_path`` is :py:data:`True`, then the ``from_`` node is
626
+ /// also connected to the ``to`` node.
621
627
  ///
622
628
  /// Args:
623
629
  /// direct_path (bool): Whether to create a direction connection
624
- /// between ``from`` and ``to`` nodes.
630
+ /// between ``from_`` and ``to`` nodes.
625
631
  ///
626
632
  /// Return:
627
633
  /// tuple[int, int]:
@@ -654,13 +660,13 @@ pub mod directed {
654
660
  }
655
661
 
656
662
  /// Return an iterator over all paths of length ``depth``
657
- /// from node ``from`` to node ``to``.
663
+ /// from node ``from_`` to node ``to``.
658
664
  ///
659
665
  /// Args:
660
666
  /// from\_ (int): The node index to find the paths from.
661
667
  /// to (int): The node index to find the paths to.
662
668
  /// depth (int): The number of nodes to include in each path.
663
- /// include_from_and_to (bool): Whether to include or not ``from``
669
+ /// include_from_and_to (bool): Whether to include or not ``from_``
664
670
  /// and ``to`` nodes in the output paths. If set to
665
671
  /// :py:data:`False`, the output paths will include
666
672
  /// ``depth - 2`` nodes.
@@ -680,13 +686,13 @@ pub mod directed {
680
686
  }
681
687
 
682
688
  /// Return an array of all paths of length ``depth``
683
- /// from node ``from`` to node ``to``.
689
+ /// from node ``from_`` to node ``to``.
684
690
  ///
685
691
  /// Args:
686
692
  /// from\_ (int): The node index to find the paths from.
687
693
  /// to (int): The node index to find the paths to.
688
694
  /// depth (int): The number of nodes to include in each path.
689
- /// include_from_and_to (bool): Whether to include or not ``from``
695
+ /// include_from_and_to (bool): Whether to include or not ``from_``
690
696
  /// and ``to`` nodes in the output paths. If set to
691
697
  /// :py:data:`False`, the output paths will include
692
698
  /// ``depth - 2`` nodes.
@@ -710,14 +716,14 @@ pub mod directed {
710
716
  }
711
717
 
712
718
  /// Return an iterator over all paths of length ``depth``
713
- /// from node ``from`` to node ``to``, grouped in chunks of
719
+ /// from node ``from_`` to node ``to``, grouped in chunks of
714
720
  /// size of max. ``chunk_size``.
715
721
  ///
716
722
  /// Args:
717
723
  /// from\_ (int): The node index to find the paths from.
718
724
  /// to (int): The node index to find the paths to.
719
725
  /// depth (int): The number of nodes to include in each path.
720
- /// include_from_and_to (bool): Whether to include or not ``from``
726
+ /// include_from_and_to (bool): Whether to include or not ``from_``
721
727
  /// and ``to`` nodes in the output paths. If set to
722
728
  /// :py:data:`False`, the output paths will include
723
729
  /// ``depth - 2`` nodes.
@@ -1029,6 +1035,28 @@ mod tests {
1029
1035
  assert_eq!(got, expected);
1030
1036
  }
1031
1037
 
1038
+ #[rstest]
1039
+ #[case(0, 2, 0, 1, 1)] // One path of depth 2 [0, 1]
1040
+ #[case(0, 2, 0, 0, 0)] // No path of depth 2 (because can't be [0, 0])
1041
+ #[case(4, 2, 0, 1, 1)] // One path of depth 2 [0, 1]
1042
+ #[case(1, 3, 1, 2, 1)] // One path of depth 3 [1, 0, 2]
1043
+ #[case(0, 1, 0, 1, 0)] // No path of depth 1
1044
+ #[case(0, 2, 0, 1, 1)] // One path of depth 2
1045
+ #[case(0, 3, 0, 1, 0)] // No path of depth 3
1046
+ #[case(0, 4, 0, 1, 0)] // No path of depth 4
1047
+ fn test_complete_graph_edge_cases(
1048
+ #[case] num_nodes: usize,
1049
+ #[case] depth: usize,
1050
+ #[case] from: usize,
1051
+ #[case] to: usize,
1052
+ #[case] expected: usize,
1053
+ ) {
1054
+ let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, false);
1055
+ let got = iter.count();
1056
+
1057
+ assert_eq!(got, expected);
1058
+ }
1059
+
1032
1060
  #[test]
1033
1061
  #[should_panic(expected = "adjacency matrix must be square")]
1034
1062
  fn test_di_graph_from_nonsquare_matrix() {
File without changes