On Wed, Feb 15, 2023 at 6:04 AM abhijit <[email protected]> wrote: > I need to create the following (data representation) - > Part P > - Part X > - Part Z > > Part Q > - Part X > - Part Z > > I was thinking this could be done by using a directed acyclic graph (dag)? > > So, I was thinking of having two tables - > > *Parts (Vertices)* > Id Name > 1 P > 2 Q > 3 X > 4 Z > > *Connections (Edges)* > Id from to > 1 P X > 2 X Z > 3 Q X > (In this table, the *from* and the *to* represent the Ids from the *Parts* > table) > > Is there any plugin available to get me the hierarchy e.g. when I'm > starting from P or when I'm starting from Q? > > I've looked into the rcte_tree and the tree plugin. Could these be used > here? >
rcte_tree may work. It's designed for trees and not dags, and I haven't tested it with dags, so I'm not sure. But in general you would want to use an recursive CTE for this. Can you try rcte_tree and see it if works for your use case? Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CADGZSSchgSFwGnZhhsBz2%3DnYNj08vgws-WcVBpjEOceLjRgApw%40mail.gmail.com.
