Skip to content

Commit 358cfd1

Browse files
committed
feat(metrics): add HubAvoidanceMetric type and export
1 parent 6e013b8 commit 358cfd1

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

src/experiments/metrics/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
*/
66

77
export * from "./collector.js";
8+
export * from "./hub-avoidance-calculator.js";
89
export * from "./storage.js";
910
export * from "./types.js";

src/experiments/metrics/types.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,42 @@ export interface MultiHubEfficiencyMetric {
222222
pathsFound: number;
223223
}
224224

225+
/**
226+
* Hub-avoidance metrics for evaluating degree-prioritised expansion.
227+
*
228+
* Measures how effectively an algorithm avoids expanding through high-degree
229+
* hub nodes during traversal. Complements path diversity by directly measuring
230+
* the design goal of hub avoidance.
231+
*/
232+
export interface HubAvoidanceMetric {
233+
/** Dataset identifier */
234+
dataset: string;
235+
236+
/** Algorithm method name */
237+
method: string;
238+
239+
/** Number of seeds (N) */
240+
n: number;
241+
242+
/** Proportion of expanded nodes that are hubs (0-1, lower is better) */
243+
hubTraversalRate: number;
244+
245+
/** Ratio of peripheral nodes expanded to hub nodes expanded (higher is better) */
246+
peripheralCoverageRatio: number;
247+
248+
/** Total nodes expanded */
249+
totalExpanded: number;
250+
251+
/** Number of hub nodes expanded (degree >= threshold) */
252+
hubCount: number;
253+
254+
/** Number of peripheral nodes expanded (degree <= threshold) */
255+
peripheralCount: number;
256+
257+
/** Optional: degree distribution as JSON string */
258+
degreeDistribution?: string;
259+
}
260+
225261
/**
226262
* Union of all metric types for internal handling
227263
*/
@@ -245,14 +281,16 @@ export type Metric =
245281
| MIRankingQualityMetric
246282
| RankingBenchmarksMetric
247283
| HubMitigationMetric
248-
| MultiHubEfficiencyMetric;
284+
| MultiHubEfficiencyMetric
285+
| HubAvoidanceMetric;
249286

250287
/**
251288
* Metric category - groups related metrics for table generation
252289
*/
253290
export type MetricCategory =
254291
| "statistical-significance"
255292
| "hub-traversal"
293+
| "hub-avoidance"
256294
| "path-lengths"
257295
| "runtime-performance"
258296
| "scalability"

0 commit comments

Comments
 (0)