simulation-alg 0.1.2__tar.gz → 0.1.3__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.
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/Cargo.lock +3 -3
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/Cargo.toml +2 -2
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/PKG-INFO +1 -1
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/pyproject.toml +1 -1
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/simulation.pyi +2 -5
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/tests/test_hyper_simulation.py +11 -5
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/.github/workflows/ci.yml +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/.gitignore +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/.gitmodules +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/LICENSE +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/README.md +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/hyper-simulation.log +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/python/__init__.py +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/requirements.txt +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/src/graph/hypergraph.rs +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/src/graph/mod.rs +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/src/graph/networkx_graph.rs +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/src/lib.rs +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/src/utils.rs +0 -0
- {simulation_alg-0.1.2 → simulation_alg-0.1.3}/tests/test_simulation.py +0 -0
|
@@ -188,9 +188,9 @@ dependencies = [
|
|
|
188
188
|
|
|
189
189
|
[[package]]
|
|
190
190
|
name = "graph-simulation"
|
|
191
|
-
version = "0.1.
|
|
191
|
+
version = "0.1.12"
|
|
192
192
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
-
checksum = "
|
|
193
|
+
checksum = "8b72985fe7d83a38c5bdf06b09b2bba47e5a57a95b21caab71b6cd1783abef36"
|
|
194
194
|
dependencies = [
|
|
195
195
|
"bincode",
|
|
196
196
|
"env_logger",
|
|
@@ -545,7 +545,7 @@ dependencies = [
|
|
|
545
545
|
|
|
546
546
|
[[package]]
|
|
547
547
|
name = "simulation"
|
|
548
|
-
version = "0.1.
|
|
548
|
+
version = "0.1.3"
|
|
549
549
|
dependencies = [
|
|
550
550
|
"graph-base",
|
|
551
551
|
"graph-simulation",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "simulation"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
description = "A Python package for simulation algorithms"
|
|
@@ -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.
|
|
17
|
+
graph-simulation = "0.1.12"
|
|
18
18
|
graph-base = "0.1.13"
|
|
19
19
|
rayon = "1.10.0"
|
|
20
20
|
# [tool.maturin]
|
|
@@ -59,9 +59,9 @@ class Hypergraph:
|
|
|
59
59
|
|
|
60
60
|
def add_hyperedge(self, hyperedge: Hyperedge): ...
|
|
61
61
|
|
|
62
|
-
def set_type_same_fn(self, type_same_fn: Callable[[str, str], bool]): ...
|
|
62
|
+
def set_type_same_fn(self, type_same_fn: Callable[[str, str], bool]): ... # L(v) = L(u)
|
|
63
63
|
|
|
64
|
-
def set_l_predicate_fn(self, l_predicate_fn: Callable[[Hyperedge, Hyperedge], bool]): ...
|
|
64
|
+
def set_l_predicate_fn(self, l_predicate_fn: Callable[[Hyperedge, Hyperedge], bool]): ... # L_P(e1, e2)
|
|
65
65
|
|
|
66
66
|
def get_node_desc_by_id(self, node_id: int) -> Optional[str]: ...
|
|
67
67
|
|
|
@@ -70,6 +70,3 @@ class Hypergraph:
|
|
|
70
70
|
"""
|
|
71
71
|
Hyper simulation.
|
|
72
72
|
"""
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
@@ -20,16 +20,22 @@ def l_match_fn(hyperedge1: Hyperedge, hyperedge2: Hyperedge) -> dict[int, set[in
|
|
|
20
20
|
mapping[id1] = {id2}
|
|
21
21
|
return mapping
|
|
22
22
|
|
|
23
|
+
def label_same_fn(desc1: str, desc2: str) -> bool:
|
|
24
|
+
"""
|
|
25
|
+
Check if two nodes are the same based on their descriptions.
|
|
26
|
+
"""
|
|
27
|
+
return desc1 == desc2
|
|
28
|
+
|
|
23
29
|
if __name__ == "__main__":
|
|
24
30
|
# Create a hypergraph
|
|
25
31
|
query = Hypergraph()
|
|
26
|
-
query.add_node("a")
|
|
27
|
-
query.add_node("b")
|
|
28
|
-
query.add_node("c")
|
|
32
|
+
query.add_node("a") # id 0
|
|
33
|
+
query.add_node("b") # id 1
|
|
34
|
+
query.add_node("c") # id 2
|
|
29
35
|
query.add_hyperedge(Hyperedge({0, 1}, "e1", 0))
|
|
30
36
|
query.add_hyperedge(Hyperedge({1, 2}, "e2", 1))
|
|
31
37
|
query.add_hyperedge(Hyperedge({0, 2}, "e3", 2))
|
|
32
|
-
query.set_type_same_fn(
|
|
38
|
+
query.set_type_same_fn(label_same_fn) # desc
|
|
33
39
|
query.set_l_predicate_fn(hyperedge_same_fn)
|
|
34
40
|
|
|
35
41
|
data = Hypergraph()
|
|
@@ -42,4 +48,4 @@ if __name__ == "__main__":
|
|
|
42
48
|
|
|
43
49
|
print("Start hyper simulation")
|
|
44
50
|
|
|
45
|
-
print(Hypergraph.hyper_simulation(query, data, l_match_fn))
|
|
51
|
+
print(Hypergraph.hyper_simulation(query, data, l_match_fn))
|
|
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
|