I'm using QuickGraph to create a graph of (P)roducts and the properties associated in them, (T)ype, (S)ubtype and (F)requency.
So in this example, I have 2 products P1 & P2:
- P1 is assigned properties T1, S1 & S2, F1
- P2 is assigned properties T1, S1, F1 & F2
The directed, unweighted graph looks like this:
Is there any way to use this generate a JSON object to hold the full paths to all products? Something like:
{T1: [
{S1: [
{F1: [
P1,P2
]},
{F2: [
P2
]}
]},
{S2: [
{F1: [
P1
]}
]}
]}
I initially looked at DepthFirstSearchAlgorithm and its DiscoverVertex event, which will walk the graph by depth but the this event is only triggered when a new vertex is discovered so I get T1,S1,F1,P1,P2,F2,S2.
Any help appreciated.