-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtree-similarity.d.ts
57 lines (51 loc) · 1012 Bytes
/
tree-similarity.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { DataXY } from "cheminfo-types";
export interface Tree {
sum: number;
center: number;
/**
* left and right have the same structure than the parent,
* or are null if they are leaves
*/
left: Tree | null;
right: Tree | null;
}
export interface CreateTreeOptions {
/**
* low limit of the tree
* @default x[0]
*/
from?: number
/**
* high limit of the tree
* @default x.at(-1)
*/
to?: number
/**
* minimal sum value to accept a node
* @default 0.01
*/
threshold?: number;
/**
* minimal window width to create a node
* @default 0.16
*/
minWindow?: number
}
export interface TreeSimilarityOptions {
alpha?: number;
beta?: number;
gamma?: number;
}
export function createTree(
dataXY: DataXY,
options: CreateTreeOptions = {},
): Tree
export function treeSimilarity(
tree1: Tree,
tree2: Tree,
options: TreeSimilarityOptions = {},
): number;
export function compressTree(
tree: Tree,
options: { fixed?: number }
)