Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lib): add option to provide TX and RX visibility #149

Merged
merged 12 commits into from
Oct 18, 2024
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions differt-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ serde = {version = "1.0.197", features = ["derive"]}
criterion = "0.5.1"
pyo3 = {version = "0.21", features = ["auto-initialize"]}
rstest = "0.18.2"
testing_logger = "0.1.1"

[features]
extension-module = ["pyo3/extension-module"]
Expand Down
4 changes: 2 additions & 2 deletions differt-core/benches/benchmarks/graph_iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn di_graph_from_complete_graph_all_paths(c: &mut Criterion) {
let mut group = c.benchmark_group("di_graph_from_complete_graph_all_paths");
group.throughput(Throughput::Elements(1));
let mut graph: DiGraph = CompleteGraph::new(NUM_NODES).into();
let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH);
let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH, None, None);

let mut iter = graph
.all_paths(from, to, DEPTH, INCLUDE_FROM_AND_TO)
Expand All @@ -60,7 +60,7 @@ fn di_graph_from_complete_graph_all_paths(c: &mut Criterion) {
fn di_graph_from_complete_graph_all_paths_array_chunks(c: &mut Criterion) {
let mut group = c.benchmark_group("di_graph_from_complete_graph_all_paths_array_chunks");
let mut graph: DiGraph = CompleteGraph::new(NUM_NODES).into();
let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH);
let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH, None, None);

for chunk_size in [1, 10, 100, 1000] {
group.throughput(Throughput::Elements(chunk_size as u64));
Expand Down
10 changes: 10 additions & 0 deletions differt-core/python/differt_core/_lowlevel/rt/graph.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import numpy as np
from jaxtyping import Bool, UInt

class CompleteGraph:
@property
def num_nodes(self) -> int: ...
def __init__(self, num_nodes: int) -> None: ...
def all_paths(
self,
Expand Down Expand Up @@ -32,6 +34,8 @@ class CompleteGraph:
) -> AllPathsFromCompleteGraphChunksIter: ...

class DiGraph:
@property
def num_nodes(self) -> int: ...
@classmethod
def from_adjacency_matrix(
cls,
Expand All @@ -43,6 +47,8 @@ class DiGraph:
self,
*,
direct_path: bool = True,
from_adjacency: Bool[np.ndarray, " num_nodes"],
to_adjacency: Bool[np.ndarray, " num_nodes"],
) -> tuple[int, int]: ...
def disconnect_nodes(self, *nodes: int, fast_mode: bool = True) -> None: ...
def all_paths(
Expand Down Expand Up @@ -75,16 +81,20 @@ class AllPathsFromCompleteGraphIter(Iterator, Sized):
def __iter__(self) -> AllPathsFromCompleteGraphIter: ...
def __next__(self) -> UInt[np.ndarray, " path_depth"]: ...
def __len__(self) -> int: ...
def count(self) -> int: ...

class AllPathsFromCompleteGraphChunksIter(Iterator, Sized):
def __iter__(self) -> AllPathsFromCompleteGraphChunksIter: ...
def __next__(self) -> UInt[np.ndarray, "chunk_size path_depth"]: ...
def __len__(self) -> int: ...
def count(self) -> int: ...

class AllPathsFromDiGraphIter(Iterator):
def __iter__(self) -> AllPathsFromDiGraphIter: ...
def __next__(self) -> UInt[np.ndarray, " path_depth"]: ...
def count(self) -> int: ...

class AllPathsFromDiGraphChunksIter(Iterator):
def __iter__(self) -> AllPathsFromDiGraphChunksIter: ...
def __next__(self) -> UInt[np.ndarray, "chunk_size path_depth"]: ...
def count(self) -> int: ...
Loading
Loading