simulation-alg 0.1.4__tar.gz → 0.1.5__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.
@@ -188,9 +188,9 @@ dependencies = [
188
188
 
189
189
  [[package]]
190
190
  name = "graph-simulation"
191
- version = "0.1.13"
191
+ version = "0.1.14"
192
192
  source = "registry+https://github.com/rust-lang/crates.io-index"
193
- checksum = "3454fd899af251471e4ca51ba6d0d47f3383ef0cb38a74d62dde14dfe01a05c4"
193
+ checksum = "b87bfc6e277b4022afe3108e71a374642b0aaceb42ea3dbeedfdd2aeb5e6ea59"
194
194
  dependencies = [
195
195
  "bincode",
196
196
  "env_logger",
@@ -14,7 +14,7 @@ crate-type = ["cdylib"]
14
14
 
15
15
  [dependencies]
16
16
  pyo3 = { version = "0.23", features = ["extension-module"] }
17
- graph-simulation = "0.1.13"
17
+ graph-simulation = "0.1.14"
18
18
  graph-base = "0.1.13"
19
19
  rayon = "1.10.0"
20
20
  # [tool.maturin]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simulation-alg
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "simulation-alg"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  requires-python = ">=3.10"
9
9
  classifiers = [
10
10
  "Programming Language :: Rust",
@@ -70,3 +70,9 @@ class Hypergraph:
70
70
  """
71
71
  Hyper simulation.
72
72
  """
73
+
74
+ @staticmethod
75
+ def soft_hyper_simulation(query: 'Hypergraph', data: 'Hypergraph', l_match_fn: Callable[[Hyperedge, Hyperedge], dict[int, set[int]]]) -> dict[int, set[int]]:
76
+ """
77
+ Hyper simulation.
78
+ """
@@ -134,6 +134,16 @@ impl Hypergraph {
134
134
  .map(|(k, v)| (k.id(), v.into_iter().map(|n| n.id()).collect()))
135
135
  .collect()
136
136
  }
137
+
138
+ #[staticmethod]
139
+ pub fn soft_hyper_simulation(query: PyRef<Hypergraph>, data: PyRef<Hypergraph>, l_match_fn: Py<PyAny>) -> HashMap<usize, HashSet<usize>> {
140
+ let mut l_match = LMatchImpl::from(l_match_fn);
141
+ let sim = HyperSimulation::get_soft_simulation_naive(&*query, &*data, &mut l_match);
142
+ // Convert HashMap<&Node, HashSet<&Node>> to HashMap<usize, HashSet<usize>>
143
+ sim.into_iter()
144
+ .map(|(k, v)| (k.id(), v.into_iter().map(|n| n.id()).collect()))
145
+ .collect()
146
+ }
137
147
  }
138
148
 
139
149
  impl Display for Node {
File without changes
File without changes