smollerGraph 0.20.2
A small graph database, from scratch
Loading...
Searching...
No Matches
query.h File Reference
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "smollergraph/graph.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  smollergraph::Path
 A path through the graph: its nodes, from its start to its end, and the relationships between them, one fewer. More...
 
struct  smollergraph::PathSearch
 What a search for a path found: the path, if there is one, and how many nodes the search reached, which is most of what it cost. More...
 

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.