question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting Node object from Edge

See original GitHub issue

When I am working with an Edge, there is a scenario where I want to find which Node is it, and I only have Memgraph node ID, and not the whole object. And I would want further to make a query with those Nodes I got from Edge property, but I can’t as I can’t make a query towards database with Memgraph ID of Node.

In other words, it would be good to return Node instead of Node-id in Memgraph when calling edge.start_node or edge.end_node

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jbajiccommented, Nov 3, 2021

So the reason for this kind of implementation is twofold. Since the memgraph as per bolt specification returns not nodes but nodes id when fetching edge the only way to tackle this issue is from the client-side. Not there can be two solutions:

  1. One would be to implicitly change every user’s query to fetch nodes as well and to bind the nodes to edges, which would make another layer of query parsing from the client’s side that would be very complicated (you would need to return all the nodes that could be found in edges). Or make it easier but slower for, for every fetched edge performer another query that would get nodes (if that didn’t already happen) => This solution is needlessly complex

  2. Another solution would be to keep the graph structure constantly in memory, in other words whenever a user would fetch nodes, we keep them in memory and map them if possible to edges (that’s how neo4j does it). The issue is an obvious inconsistency, sometimes you get id and sometimes you get node…

And that’s the reason this implementation has not changed much from current, I think what you are looking for is great but that would be a feature for a higher level querying (OGM)

0reactions
antoniofilipoviccommented, Nov 10, 2021

Okay, I really didn’t have an idea how such a feature could complicate things easily a lot. It makes sense for the user to handle nodes in a query then due to the reasons you provided. Thanks for such a detailed answer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need to pass node object created in loop to edges
2) For each edge in edges, create edge with 'source', 'target'. The problem that I am having is that to create the edge...
Read more >
Get started viewing and changing the DOM - Microsoft Edge ...
To edit the tag name of a node, double-click the tag name and then type in the new tag name. Open the DOM...
Read more >
Edge Detect Node for Blender 2.8 - YouTube
Hello Blender friends. Here is a quick demonstration on how to use a Node Group I created to add edge detail to 3D...
Read more >
Finding the corresponding node in array using edges in ...
So, the simple answer is: For the current node: Find all Edges such that current node as Source, that have a Target that...
Read more >
get_edges: Get node IDs associated with edges in DiagrammeR
Obtain a vector, data frame, or list of node IDs associated with edges in a graph object. An optional filter by edge attribute...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found