add all missing functions for graph
This commit is contained in:
@@ -411,6 +411,16 @@ class SubgraphDbAccessor final {
|
||||
// todo antoniofilipovic add vertex to subgraph
|
||||
return result;
|
||||
}
|
||||
|
||||
VerticesIterable Vertices(storage::View view) {
|
||||
// todo antoniofilipovic change to get vertices from subgraph
|
||||
return db_accessor_->Vertices(view);
|
||||
}
|
||||
|
||||
std::optional<VertexAccessor> FindVertex(storage::Gid gid, storage::View view) {
|
||||
// todo antoniofilipovic change to get vertex from subgraph
|
||||
return db_accessor_->FindVertex(gid, view);
|
||||
}
|
||||
};
|
||||
|
||||
class SubgraphVertexAccessor final {
|
||||
|
||||
@@ -2169,17 +2169,16 @@ mgp_error mgp_edge_iter_properties(mgp_edge *e, mgp_memory *memory, mgp_properti
|
||||
mgp_error mgp_graph_get_vertex_by_id(mgp_graph *graph, mgp_vertex_id id, mgp_memory *memory, mgp_vertex **result) {
|
||||
return WrapExceptions(
|
||||
[graph, id, memory]() -> mgp_vertex * {
|
||||
auto maybe_vertex = std::visit(
|
||||
memgraph::utils::Overloaded{
|
||||
[graph, id](memgraph::query::DbAccessor *impl) {
|
||||
return impl->FindVertex(memgraph::storage::Gid::FromInt(id.as_int), graph->view);
|
||||
},
|
||||
[graph,
|
||||
id](memgraph::query::SubgraphDbAccessor *impl) -> std::optional<memgraph::query::VertexAccessor> {
|
||||
throw std::logic_error{"cannot process this"};
|
||||
},
|
||||
},
|
||||
graph->impl);
|
||||
auto maybe_vertex =
|
||||
std::visit(memgraph::utils::Overloaded{
|
||||
[graph, id](memgraph::query::DbAccessor *impl) {
|
||||
return impl->FindVertex(memgraph::storage::Gid::FromInt(id.as_int), graph->view);
|
||||
},
|
||||
[graph, id](memgraph::query::SubgraphDbAccessor *impl) {
|
||||
return impl->FindVertex(memgraph::storage::Gid::FromInt(id.as_int), graph->view);
|
||||
},
|
||||
},
|
||||
graph->impl);
|
||||
if (maybe_vertex) {
|
||||
return NewRawMgpObject<mgp_vertex>(memory, *maybe_vertex, graph);
|
||||
}
|
||||
|
||||
@@ -698,13 +698,11 @@ struct mgp_vertices_iterator {
|
||||
mgp_vertices_iterator(mgp_graph *graph, memgraph::utils::MemoryResource *memory)
|
||||
: memory(memory),
|
||||
graph(graph),
|
||||
vertices(std::visit(memgraph::utils::Overloaded{
|
||||
[graph](memgraph::query::DbAccessor *impl) { return impl->Vertices(graph->view); },
|
||||
[](memgraph::query::SubgraphDbAccessor *impl) -> memgraph::query::VerticesIterable {
|
||||
throw std::logic_error{"cannot process this"};
|
||||
},
|
||||
},
|
||||
graph->impl)),
|
||||
vertices(
|
||||
std::visit(memgraph::utils::Overloaded{
|
||||
[graph](memgraph::query::DbAccessor *impl) { return impl->Vertices(graph->view); },
|
||||
[graph](memgraph::query::SubgraphDbAccessor *impl) { return impl->Vertices(graph->view); }},
|
||||
graph->impl)),
|
||||
current_it(vertices.begin()) {
|
||||
if (current_it != vertices.end()) {
|
||||
current_v.emplace(*current_it, graph, memory);
|
||||
|
||||
Reference in New Issue
Block a user