Please, help me with Datafrog. I have a simple example from the main page of the project:
extern crate datafrog;
use datafrog::Iteration;
fn main() {
// my input values
let nodes = vec![(0,0),(1,1)];
let edges = vec![(0,1)];
dbg!(&nodes,&edges);
// Create a new iteration context, ...
let mut iteration = Iteration::new();
// .. some variables, ..
let nodes_var = iteration.variable::<(u32,u32)>("nodes");
let edges_var = iteration.variable::<(u32,u32)>("edges");
// .. load them with some initial values, ..
nodes_var.insert(nodes.into());
edges_var.insert(edges.into());
// .. and then start iterating rules!
while iteration.changed() {
// nodes(a,c) <- nodes(a,b), edges(b,c)
nodes_var.from_join(&nodes_var, &edges_var, |_b, &a, &c| (c,a));
}
// extract the final results.
let reachable: Vec<(u32,u32)> = nodes_var.complete().to_vec();
dbg!(&reachable);
}
The output of the examle is:
[test_datafrog_1/src/main.rs:8] &nodes = [
(
0,
0,
),
(
1,
1,
),
]
[test_datafrog_1/src/main.rs:8] &edges = [
(
0,
1,
),
]
[test_datafrog_1/src/main.rs:30] &reachable = [
(
0,
0,
),
(
1,
0,
),
(
1,
1,
),
]
- Are my input values valid?
- How I can intepret the output? What does it mean?