I'm trying to link nodes in a node edge graph by a foreign key. The problem is that the visualization groups the nodes based on the FK. Settings the Node ID column to the PK but still setting the edge source to the FK doesn't have the expected behavior, instead it treats the PK as the FK and the edge connections are all wrong. How do I link edges based on a key that isn't the node ID column?
It is currently required that the values from the source and destination column in a row of an edge table contains the same value as the ID column from a node table. The node-edge graph is not aware of anything else besides the raw data it receives from the tables and the context that is given through the component settings (how to identify a node, where to look for the source and where to look for the destination). This makes it very powerfull, as it can link basically everything, but it is required that all data needed to make the links are provided by the queries. If there would be a foreign key relation somewhere in the data, this is not known by the node-edge.
But we could probably also forward this foreign key info to the node-edge by extending our edge query a bit. By adding two join operators to the edge query we can include the PK from the nodes inside the query. Then we should select those 2 new columns as source and destination in the configuration of an edge.
There will be an edge drawn between source and destination node for each row there is in the table from the edge query that has the source node ID in its source column and destination node ID in its destination column. So I would expect that if there are 3 edges between node (ID:X) en node (ID:Y), there are 3 rows in the edge table with X as source and Y as destination.
The reason why it behaves like this, is because the other columns of an edge row can contain valuable information and this information should remain accessable in the node-edge. So hovering over an edge will list that information.
Can you check if this is indeed the case that there are multiple rows between the same source and destination. If that’s not the case, then this might be a software issue we’ll have to tackle. If it is the case though, and you don’t want this behavior, then there will be some extra fiddling needed with the query to remove duplicate source/destination rows.
After fiddling around a bit I got the links to connect as I wanted but there seems to be 3 edges per node instead of just 1.