MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / count_similar_to_edges

Function count_similar_to_edges

tests/test_simhash.c:45–67  ·  view source on GitHub ↗

Count SIMILAR_TO edges in graph buffer. */

Source from the content-addressed store, hash-verified

43
44/* Count SIMILAR_TO edges in graph buffer. */
45static int count_similar_to_edges(const cbm_gbuf_t *gb) {
46 int count = 0;
47 /* Iterate all edges via label-based node search + edge queries */
48 const cbm_gbuf_node_t **funcs = NULL;
49 int func_count = 0;
50 cbm_gbuf_find_by_label(gb, "Function", &funcs, &func_count);
51 for (int i = 0; i < func_count; i++) {
52 const cbm_gbuf_edge_t **edges = NULL;
53 int edge_count = 0;
54 cbm_gbuf_find_edges_by_source_type(gb, funcs[i]->id, "SIMILAR_TO", &edges, &edge_count);
55 count += edge_count;
56 }
57 const cbm_gbuf_node_t **methods = NULL;
58 int method_count = 0;
59 cbm_gbuf_find_by_label(gb, "Method", &methods, &method_count);
60 for (int i = 0; i < method_count; i++) {
61 const cbm_gbuf_edge_t **edges = NULL;
62 int edge_count = 0;
63 cbm_gbuf_find_edges_by_source_type(gb, methods[i]->id, "SIMILAR_TO", &edges, &edge_count);
64 count += edge_count;
65 }
66 return count;
67}
68
69/* Large Go function template for fingerprint tests. Must have enough
70 * structural diversity (>= 32 unique structural trigrams) after leaf-only

Callers 1

test_simhash.cFile · 0.85

Calls 2

cbm_gbuf_find_by_labelFunction · 0.85

Tested by

no test coverage detected