MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / MakeConnected

Function MakeConnected

src/test/fuzz/cluster_linearize.cpp:268–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266/** Stitch connected components together in a DepGraph, guaranteeing its corresponding cluster is connected. */
267template<typename BS>
268void MakeConnected(DepGraph<BS>& depgraph)
269{
270 auto todo = depgraph.Positions();
271 auto comp = depgraph.FindConnectedComponent(todo);
272 Assume(depgraph.IsConnected(comp));
273 todo -= comp;
274 while (todo.Any()) {
275 auto nextcomp = depgraph.FindConnectedComponent(todo);
276 Assume(depgraph.IsConnected(nextcomp));
277 depgraph.AddDependencies(BS::Singleton(comp.Last()), nextcomp.First());
278 todo -= nextcomp;
279 comp = nextcomp;
280 }
281}
282
283/** Given a dependency graph, and a todo set, read a topological subset of todo from reader. */
284template<typename SetType>

Callers 1

FUZZ_TARGETFunction · 0.85

Calls 6

IsConnectedMethod · 0.45
AnyMethod · 0.45
AddDependenciesMethod · 0.45
LastMethod · 0.45
FirstMethod · 0.45

Tested by

no test coverage detected