|
smollerGraph 0.20.2
A small graph database, from scratch
|
#include <cstddef>#include <cstdint>#include <string_view>#include <utility>#include <vector>#include "smollergraph/graph.h"
Go to the source code of this file.
Namespaces | |
| namespace | smollergraph |
Functions | |
| std::vector< Embedding > | smollergraph::FastRP (const Graph &graph, std::string_view type, uint32_t seed) |
Returns an embedding for each node, in the order of their ids, computed with FastRP, as Neo4j's Graph Data Science library does: a sparse random vector for each node, then five rounds, in each of which a node's vector is the sum of its neighbours' vectors from the round before, along relationships of type followed both ways, scaled to a length of one. | |
| float | smollergraph::Cosine (const Embedding &a, const Embedding &b) |
| How alike two embeddings are: the cosine of the angle between them, 1 when they point the same way, 0 at right angles, and -1 when they're opposite. | |
| std::vector< std::pair< NodeId, float > > | smollergraph::MostSimilar (const std::vector< Embedding > &embeddings, NodeId node, size_t k) |
Returns the k nodes whose embeddings are most like node's, with their cosines, the most alike first. | |