Good question, Raj!
You can define a "virtual" edge by reusing the existing node table `Interest`. This technique is recommended by us at the user guide: https://cloud.google.com/spanner/docs/graph/best-practices-designing-schema#merging-node-and-edge-input-tables
CREATE PROPERTY GRAPH TestGraph
NODE TABLES (
InterestCategory,
Interest,
)
EDGE TABLES (
Interest AS ContainsInterest
SOURCE KEY (interest_category_id) REFERENCES InterestCategory
DESTINATION KEY (interest_id) REFERENCES Interest
)
Query will appear as
GRAPH TestGraph
MATCH p = (n:InterestCategory)-[:ContainsInterest]->(b:Interest)
RETURN TO_JSON(p) as interest_paths;
Given that the two tables have FK reference constraint and shares the prefix key, you can employ INTERLEAVE IN PARENT
technique to optimize the schema design, as we recommended here in the user guide: https://cloud.google.com/spanner/docs/graph/best-practices-designing-schema#optimize-forward-edge-traversal