Giter VIP home page Giter VIP logo

graphanns's Introduction

GraphANNS: Graph-based Approximate Nearest Neighbor Search Working off CGraph

This repository contains a unified pipeline with seven fine-grained components for performing graph-based ANNS algorithms. Given a graph-based ANNS algorithms (such as NSG, HNSW), we can break it down to seven fine-grained components according to this framework, and run it through the CGraph's scheduling. Interestingly, we can obtain a better algorithm quickly by combining the existing algorithms' best-performing components, even without designing a new component. Of course, we can also optimize the components to further improve the algorithm's performance.

Background

Approximate Nearest Neighbor Search(ANNS) is a task that finds the approximate nearest neighbors among a high-dimensional dataset for a query via a well-designed index. According to the index adopted, the existing ANNS algorithms can be divided into four major types: hashing-based; tree-based; quantization-based; and graph-based algorithms. Recently, graph-based algorithms have emerged as a highly effective option for ANNS. Thanks to graph-based ANNS algorithms' extraordinary ability to express neighbor relationships, they only need to evaluate fewer points of dataset to receive more accurate results, comparing to other categories.

Install

This project supports MacOS, Linux, and Windows platforms, requiring CGraph. You can download this project by running the following instructions.

git clone --recursive [email protected]:whenever5225/GraphANNS.git

If you are a developer using CLion as the IDE, you can open the CMakeLists.txt file as a project for compiling.

Usage

You need to configure the data file, index file, and parameters in here (please refer to here for test data download). Suppose you use 'npg' algorithm and 'siftsmall' dataset, you can modify the data path to yours in its configure file (graph_anns_define.h):

const static char* GA_ALG_BASE_PATH = "your_base_data_root_path/siftsmall/siftsmall_base.fvecs";
const static char* GA_ALG_QUERY_PATH = "your_base_data_root_path/siftsmall/siftsmall_query.fvecs";
const static char* GA_ALG_GROUNDTRUTH_PATH = "your_base_data_root_path/siftsmall/siftsmall_groundtruth.ivecs";
const static char* GA_ALG_INDEX_PATH = "your_base_data_root_path/anns.index";

const static unsigned GA_NPG_L_CANDIDATE = 100;      // size of candidate set for neighbor selection
const static unsigned GA_NPG_R_NEIGHBOR = 100;       // size of neighbor set
const static unsigned GA_NPG_C_NEIGHBOR = 200;       // number of visited candidate neighbors when neighbor selection
const static unsigned GA_NPG_K_INIT_GRAPH = 20;      // number of neighbors of initial graph

HINT: Please refer here for the description of fvecs/ivecs format.

graphanns's People

Contributors

chunelfeng avatar whenever5225 avatar

Watchers

 avatar  avatar

Forkers

likehuaer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.