You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
graphs <- generate_graphs(1000, p = 0.25) # dense graph
68
70
cg <- graphs$cg
69
71
ig <- graphs$ig
@@ -94,32 +96,42 @@ bench::mark(
94
96
dagitty::parents(dg, test_node_name)
95
97
dagitty::children(dg, test_node_name)
96
98
},
97
-
check = FALSE # rust output are indexes, so check fails
99
+
check = FALSE # igraph returns igraph object
98
100
)
99
101
```
100
102
101
-
`bnlearn` is fastest here, but is only able to handle smaller graphs, whereas `caugi` can handle very large graph objects with almost no time increase:
103
+
`bnlearn` is fastest here, but is only able to handle smaller graphs, whereas `caugi`and `igraph`can handle very large graph objects with almost no time increase:
102
104
103
105
```{r benchmark-parents-children-large-graph}
104
106
large_cg <- generate_graph(n = 40000, m = 1000000, class = "DAG")
For ancestors and descendants, we see that `caugi` outperforms all other packages by a large margin:
123
+
For ancestors and descendants, we see that `caugi` outperforms all other packages by a several magnitudes, expect for `igraph`, which it still beats, but by a smaller margin::
116
124
117
-
```{r an-de-an}
125
+
```{rbenchmark-an-de}
118
126
bench::mark(
119
127
caugi = {
120
128
caugi::ancestors(cg, "V500")
121
129
caugi::descendants(cg, "V500")
122
130
},
131
+
igraph = {
132
+
igraph::subcomponent(ig, "V500", mode = "in")
133
+
igraph::subcomponent(ig, "V500", mode = "out")
134
+
},
123
135
bnlearn = {
124
136
bnlearn::ancestors(bng, "V500")
125
137
bnlearn::descendants(bng, "V500")
@@ -129,7 +141,7 @@ bench::mark(
129
141
dagitty::descendants(dg, "V500")
130
142
},
131
143
iterations = 10,
132
-
check = FALSE # dagitty returns V500 as well.
144
+
check = FALSE # dagitty returns V500 as well and igraph returns an igraph
133
145
)
134
146
```
135
147
@@ -156,7 +168,6 @@ bench::mark(
156
168
Here we see an example of where the frontloading hurts performance. When we build a subgraph, we have to rebuild the entire `caugi` graph object. Here, we see that while `caugi` outperforms other packages for queries (except for parents/children for `bnlearn`), it is slower for building the graph objects themselves, which shows for the subgraph benchmark:
0 commit comments