PC Review


Reply
Thread Tools Rate Thread

Algorithm Suggestion/Help (buiding strings from a graph)

 
 
Jeremy S.
Guest
Posts: n/a
 
      23rd Jun 2008
Using .NET 3.5.I need to build a collection of strings given the following
input (presented in the app as a DataTable):

NodeID --- ParentNodeID --- CultureName --- NodeText
1 --- 2 --- fr-FR --- Crepes
1 --- 2 --- en-US --- Pancakes
2 --- null --- fr-FR --- Petit-Déjeuner
2 --- null --- en-US --- Breakfast
3 --- null --- en-US --- Veggies
4 --- 3 --- en-US --- Carrots
5 --- 3 --- en-US --- Peas
6 --- 5 --- en-US --- Snow Peas
7 --- 5 --- en-US --- Snap Peas
8 --- 6 --- en-US --- Large
9 --- 10 --- fr-FR --- Pois
10 --- null --- fr-FR --- Légumes

* Each string is to represent a complete valid "path" from a root node to
each possible child node, with nodes delimited with the '/' character.
* A root node is a row with a NULL ParentNodeID value
* This is a graph, not a tree, as each "child" node can have multiple
parents, and each parent can have multiple child nodes. For example, in the
sample data set, NodeID 1 has multiple parents (nodeID 2. differentiated on
CultureName).

The output string collection given the above sample DataTable input would
include these as valid strings (the output sequence is not important)

Petit-Déjeuner
Breakfast
Veggies
Légumes
Petit-Déjeuner/Crepes
Breakfast/Pancakes
Veggies/Carrots
Veggies/Peas
Veggies/Peas/Snow Peas
Veggies/Peas/Snow Peas/Large
Veggies/Peas/Snap Peas
Légumes/Pois

This string.
Breakfast/Crepes
.. would NOT be valid because the CultureName does not match between the
parent node (Breakfast is en-US) and child node (Crepes is fr-FR).

I would very much appreciate a suggestion for an algorithm I could use or
tweak to get what I need here.

Thanks



 
Reply With Quote
 
 
 
 
Micha³ Piaskowski
Guest
Posts: n/a
 
      23rd Jun 2008

Jeremy S. wrote:

> * This is a graph, not a tree, as each "child" node can have multiple
> parents, and each parent can have multiple child nodes. For example, in the
> sample data set, NodeID 1 has multiple parents (nodeID 2. differentiated on
> CultureName).


If you group the records in source table by CultureName won't that
reduce this graph to a set of trees (one tree for each culture) and
also eliminate all invalid results ( like Breakfast/Crepes )?
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I select which framework to use when buiding my app Tony Johansson Microsoft C# .NET 3 28th Feb 2010 12:42 AM
algorithm to find all unique email id strings in an array sfdev2000@yahoo.com Microsoft C# .NET 4 23rd Feb 2008 03:35 AM
Need help buiding a worksheet. =?Utf-8?B?VmFjaG9lbg==?= Microsoft Excel Misc 1 2nd Oct 2005 07:34 PM
Webware suggestion: Graph Paper (PDFs) Jonathan Aquino Freeware 2 25th Oct 2004 07:33 PM
Algorithm to compress strings Crirus Microsoft VB .NET 2 23rd Dec 2003 01:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 AM.