smollerGraph 0.20.2
A small graph database, from scratch
Loading...
Searching...
No Matches
query.cc File Reference
#include "smollergraph/query.h"
#include <algorithm>
#include <cstdint>
#include <functional>
#include <limits>
#include <optional>
#include <queue>
#include <string>
#include <unordered_map>
#include <utility>
#include <variant>
#include <vector>
#include "absl/strings/str_cat.h"

Go to the source code of this file.

Namespaces

namespace  smollergraph
 

Functions

std::vector< NodeId > smollergraph::Walk (const Graph &graph, NodeId start, std::string_view type, int hops)
 Returns the nodes exactly hops relationships of type away from start, each once, in the order a breadth-first walk reaches them.
 
std::vector< std::vector< NodeId > > smollergraph::WalkHops (const Graph &graph, NodeId start, std::string_view type, int hops)
 Returns the nodes each hop of that walk reaches: the start on its own, then the nodes one hop away, and so on, so the last of them is what Walk returns.
 
PathSearch smollergraph::ShortestPath (const Graph &graph, NodeId from, NodeId to, const std::vector< std::string > &types, Direction direction)
 Returns a shortest path from from to to, along relationships of any of types followed in direction: one with as few hops as any other.
 
PathSearch smollergraph::CheapestPath (const Graph &graph, NodeId from, NodeId to, const std::vector< std::string > &types, Direction direction, std::string_view key)
 Returns a cheapest path from from to to, along relationships of any of types followed in direction: one whose relationships' weights, their property key, add up to as little as any other's, found with Dijkstra's algorithm.
 
std::string smollergraph::PathText (const Graph &graph, const Path &path)
 A path as Cypher writes it, with the nodes' names, and each relationship's arrow pointing the way it goes, with its properties in braces.
 

Variable Documentation

◆ costs

std::unordered_map<NodeId, int64_t> costs

Definition at line 88 of file query.cc.

◆ direction

Direction direction

Definition at line 42 of file query.cc.

◆ frontier

std::vector<NodeId> frontier

Definition at line 44 of file query.cc.

◆ parents

Parents parents

Definition at line 43 of file query.cc.

◆ queue

Queue queue

Definition at line 90 of file query.cc.