alexisfacques / node-fpgrowth

FPGrowth Algorithm implementation in TypeScript / JavaScript.
https://www.npmjs.com/package/node-fpgrowth
MIT License
16 stars 0 forks source link

Feat: Get related items of a given item order by support #4

Open artsnr1 opened 4 years ago

artsnr1 commented 4 years ago

Currently it gives me all possible itemsets. What I want is a function that accepts an item and returns all its pairs (excluding itself) sorted in order of support getRelatedItems(item, maxItems?)

var transactions = [ [1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5], [1, 2, 3, 5] ]; getRelatedItems(1) // Output: [3, 5, 2] getRelatedItems(2) // Output: [5, 3, 1] getRelatedItems(3) // Output: [5, 2, 1] getRelatedItems(4) // Output: [] getRelatedItems(5) // Output: [2, 3, 1]