differt-core 0.0.16__tar.gz → 0.0.17__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.
- {differt_core-0.0.16 → differt_core-0.0.17}/Cargo.lock +1 -1
- {differt_core-0.0.16 → differt_core-0.0.17}/PKG-INFO +1 -1
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/Cargo.toml +1 -1
- {differt_core-0.0.16 → differt_core-0.0.17/differt-core}/python/differt_core/_lowlevel/rt/graph.pyi +1 -0
- {differt_core-0.0.16 → differt_core-0.0.17/differt-core}/python/differt_core/rt/graph.py +1 -1
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/rt/graph.rs +30 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/rt/test_graph.py +34 -0
- {differt_core-0.0.16/differt-core → differt_core-0.0.17}/python/differt_core/_lowlevel/rt/graph.pyi +1 -0
- {differt_core-0.0.16/differt-core → differt_core-0.0.17}/python/differt_core/rt/graph.py +1 -1
- {differt_core-0.0.16 → differt_core-0.0.17}/Cargo.toml +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/LICENSE.md +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/README.md +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/benches/bench_main.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/benches/benchmarks/graph_iterators.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/benches/benchmarks/mod.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/__init__.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/scene/sionna.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/geometry/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/geometry/triangle_mesh.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/py.typed +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/rt/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/sionna.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/triangle_scene.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/geometry/mod.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/geometry/triangle_mesh.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/lib.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/rt/mod.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/scene/mod.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/scene/sionna.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/src/scene/triangle_scene.rs +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/benchmarks/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/benchmarks/conftest.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/benchmarks/test_graph.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/differt-core/tests/rt/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/pyproject.toml +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/__init__.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/scene/sionna.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/geometry/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/geometry/triangle_mesh.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/py.typed +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/rt/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/scene/__init__.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/scene/sionna.py +0 -0
- {differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/scene/triangle_scene.py +0 -0
{differt_core-0.0.16 → differt_core-0.0.17/differt-core}/python/differt_core/_lowlevel/rt/graph.pyi
RENAMED
|
@@ -31,6 +31,7 @@ class DiGraph:
|
|
|
31
31
|
def insert_from_and_to_nodes(
|
|
32
32
|
self, *, direct_path: bool = True
|
|
33
33
|
) -> tuple[int, int]: ...
|
|
34
|
+
def disconnect_nodes(self, *nodes: int, fast_mode: bool = True) -> None: ...
|
|
34
35
|
def all_paths(
|
|
35
36
|
self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
|
|
36
37
|
) -> AllPathsFromDiGraphIter: ...
|
|
@@ -685,6 +685,36 @@ pub mod directed {
|
|
|
685
685
|
(from, to)
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
+
/// Disconnect one or more nodes from the graph.
|
|
689
|
+
///
|
|
690
|
+
/// This has two effects:
|
|
691
|
+
///
|
|
692
|
+
/// - all paths from any of the specified nodes will be removed;
|
|
693
|
+
/// - and all paths to any of the specified nodes will be removed.
|
|
694
|
+
///
|
|
695
|
+
/// Args:
|
|
696
|
+
/// nodes (int): The nodes to be disconnected.
|
|
697
|
+
/// fast\_mode (bool): Whether to skip removing the path to any
|
|
698
|
+
/// of the specified nodes. In practice, removing paths
|
|
699
|
+
/// from the nodes is sufficient, and faster to perform,
|
|
700
|
+
/// but can lead to a slower graph traversal when
|
|
701
|
+
/// generating all possible paths.
|
|
702
|
+
#[pyo3(signature = (*nodes, fast_mode=true))]
|
|
703
|
+
#[pyo3(text_signature = "(self, *nodes, fast_mode=True)")]
|
|
704
|
+
pub fn disconnect_nodes(&mut self, mut nodes: Vec<usize>, fast_mode: bool) {
|
|
705
|
+
for i in nodes.iter() {
|
|
706
|
+
self.edges_list[*i].clear();
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
if !fast_mode {
|
|
710
|
+
nodes.sort();
|
|
711
|
+
|
|
712
|
+
for edge in self.edges_list.iter_mut() {
|
|
713
|
+
edge.retain(|node| nodes.binary_search(node).is_err());
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
688
718
|
/// Return an iterator over all paths of length ``depth``
|
|
689
719
|
/// from node ``from_`` to node ``to``.
|
|
690
720
|
///
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import numpy as np
|
|
1
2
|
import pytest
|
|
2
3
|
|
|
3
4
|
from differt_core.rt.graph import (
|
|
@@ -24,6 +25,39 @@ class TestDiGraph:
|
|
|
24
25
|
):
|
|
25
26
|
_ = graph.insert_from_and_to_nodes(True) # type: ignore
|
|
26
27
|
|
|
28
|
+
@pytest.mark.parametrize("fast_mode", (True, False))
|
|
29
|
+
def test_disconnect_nodes(self, fast_mode: bool) -> None:
|
|
30
|
+
graph = DiGraph.from_complete_graph(CompleteGraph(6))
|
|
31
|
+
from_, to = graph.insert_from_and_to_nodes()
|
|
32
|
+
|
|
33
|
+
nodes = (0, 1, 2, 5)
|
|
34
|
+
graph.disconnect_nodes(*nodes, fast_mode=fast_mode)
|
|
35
|
+
|
|
36
|
+
for depth in range(0, 3):
|
|
37
|
+
for path in graph.all_paths(
|
|
38
|
+
from_, to, depth + 2, include_from_and_to=False
|
|
39
|
+
):
|
|
40
|
+
for node in nodes:
|
|
41
|
+
assert node not in path
|
|
42
|
+
|
|
43
|
+
@pytest.mark.parametrize("fast_mode", (True, False))
|
|
44
|
+
def test_disconnect_nodes_equivalence(self, fast_mode: bool) -> None:
|
|
45
|
+
complete_graph = CompleteGraph(3)
|
|
46
|
+
di_graph = DiGraph.from_complete_graph(CompleteGraph(6))
|
|
47
|
+
from_, to = di_graph.insert_from_and_to_nodes()
|
|
48
|
+
|
|
49
|
+
nodes = (3, 4, 5)
|
|
50
|
+
di_graph.disconnect_nodes(*nodes, fast_mode=fast_mode)
|
|
51
|
+
|
|
52
|
+
for depth in range(0, 3):
|
|
53
|
+
complete_paths = complete_graph.all_paths_array(
|
|
54
|
+
from_, to, depth + 2, include_from_and_to=False
|
|
55
|
+
)
|
|
56
|
+
di_paths = di_graph.all_paths_array(
|
|
57
|
+
from_, to, depth + 2, include_from_and_to=False
|
|
58
|
+
)
|
|
59
|
+
np.testing.assert_equal(complete_paths, di_paths)
|
|
60
|
+
|
|
27
61
|
def test_from_graph(self) -> None:
|
|
28
62
|
graph = CompleteGraph(10)
|
|
29
63
|
assert isinstance(graph, CompleteGraph)
|
{differt_core-0.0.16/differt-core → differt_core-0.0.17}/python/differt_core/_lowlevel/rt/graph.pyi
RENAMED
|
@@ -31,6 +31,7 @@ class DiGraph:
|
|
|
31
31
|
def insert_from_and_to_nodes(
|
|
32
32
|
self, *, direct_path: bool = True
|
|
33
33
|
) -> tuple[int, int]: ...
|
|
34
|
+
def disconnect_nodes(self, *nodes: int, fast_mode: bool = True) -> None: ...
|
|
34
35
|
def all_paths(
|
|
35
36
|
self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
|
|
36
37
|
) -> AllPathsFromDiGraphIter: ...
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/benches/benchmarks/graph_iterators.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/_lowlevel/__init__.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/geometry/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/__init__.py
RENAMED
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/sionna.py
RENAMED
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/differt-core/python/differt_core/scene/triangle_scene.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{differt_core-0.0.16 → differt_core-0.0.17}/python/differt_core/_lowlevel/scene/triangle_scene.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|