Platform
Resources
Pricing
Sign in
Get started
min tian
Workspace
Fork
Published
By
min tian
Edited
Jun 28, 2022
Insert cell
Insert cell
Insert cell
FederModule
=
import
(
"https://unpkg.com/@zilliz/feder"
)
Insert cell
FederCore
=
FederModule
.
FederCore
Insert cell
Insert cell
Insert cell
indexArrayBuffer
=
fetch
(
indexFilePath
)
.
then
(
(
res
)
=>
res
.
arrayBuffer
(
)
)
Insert cell
federCore
=
new
FederCore
(
{
data
:
indexArrayBuffer
,
source
:
indexSource
,
}
)
Insert cell
indexMeta
=
federCore
.
indexMeta
Insert cell
testId
=
Math
.
floor
(
Math
.
random
(
)
*
10000
)
Insert cell
testVector
=
federCore
.
id2vector
[
testId
]
Insert cell
searchRes
=
federCore
.
search
(
testVector
)
Insert cell
visData
=
parseVisRecords
(
searchRes
)
Insert cell
HNSW_NODE_TYPE
=
{
return
{
Coarse
:
1
,
Candidate
:
2
,
Fine
:
3
,
Target
:
4
}
;
}
Insert cell
HNSW_LINK_TYPE
=
{
return
{
None
:
0
,
Visited
:
1
,
Extended
:
2
,
Searched
:
3
,
Fine
:
4
}
;
}
Insert cell
Insert cell
Insert cell
connection
=
'---'
;
Insert cell
getLinkId
=
(
sourceId
,
targetId
)
=>
`${
sourceId
}${
connection
}${
targetId
}`
;
Insert cell
parseLinkId
=
(
linkId
)
=>
linkId
.
split
(
connection
)
.
map
(
(
d
)
=>
+
d
)
;
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
FederModule
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
FederCore
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
indexSource
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
indexFilePath
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
indexArrayBuffer
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
federCore
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
indexMeta
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
testId
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
testVector
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
searchRes
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
visData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
HNSW_NODE_TYPE
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
HNSW_LINK_TYPE
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
parseVisRecords
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
deDupLink
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
connection
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getLinkId
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
parseLinkId
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML