Click here to Skip to main content
15,889,335 members
Home / Discussions / C#
   

C#

 
GeneralRe: Praffic System Project Pin
Pete O'Hanlon5-Feb-09 11:09
mvePete O'Hanlon5-Feb-09 11:09 
GeneralRe: Praffic System Project Pin
Member 39168569-Feb-09 4:04
Member 39168569-Feb-09 4:04 
AnswerRe: Praffic System Project Pin
harold aptroot5-Feb-09 10:49
harold aptroot5-Feb-09 10:49 
GeneralRe: Praffic System Project Pin
Member 39168569-Feb-09 4:05
Member 39168569-Feb-09 4:05 
QuestionFast data retrieval method? Pin
Gareth H5-Feb-09 5:45
Gareth H5-Feb-09 5:45 
AnswerRe: Fast data retrieval method? Pin
musefan5-Feb-09 6:11
musefan5-Feb-09 6:11 
AnswerRe: Fast data retrieval method? Pin
Wendelius5-Feb-09 6:30
mentorWendelius5-Feb-09 6:30 
GeneralRe: Fast data retrieval method? [modified] Pin
Gareth H5-Feb-09 22:26
Gareth H5-Feb-09 22:26 
Yes I do use recursion. I'll try to explain it more in depth. I am building a graph using a 3rd party DLL (see: yWorks.com). The model builds around 4k relationships every 10 seconds when viewing a large amount of data (95k relationships). The model is built on levels, e.g: when the user first opens the program, it retrieves all the data for the whole model, and builds 2 levels. The user can then expand to as many levels as they like.

Below is a quick sample of the code I use to build the model.

private void BuildModel(Node node, int currentLevel)
{
    //ModelLevel is the level the user wants to view
    if ((currentLevel + 1) > _modelLevel)
        return;

    currentLevel++;

    DataRow[] matchingRows = _relationshipDataSet.Tables[0].Select("[" + PARENT + "] = '" + node.Name + "'");
    if (matchingRows == null || matchingRows.Length == 0)
        return;

    foreach (DataRow row in matchingRows)
    {
        string childName = row[CHILD].ToString();

        //Node isnt in the current model, so create it
        string nodeHashCode = childName + node.Name + node.GetHashCode().ToString();
        if (!_graphNodeHashSet.Contains(nodeHashCode))
        {
            _graphNodeHashSet.Add(nodeHashCode);

            //Create node
            //....

            //Create the children of this node
            BuildModel(childNode, currentLevel);
        }
        else
        {
            //Node is in the current model, get it out of a local collection, and build its children
            List<node> nodeList = new List<node>();
            bool isValid = _nodeDictionary.TryGetValue(childName, out nodeList);
            if (isValid)
            {
                foreach (Node childNode in nodeList)
                {
                    //Create the children of this node
                    BuildModel(childNode, currentLevel);
                }
            }
        }
    }
}</node></node>


Hope this helps some more. I am also using .NET 2.

Regards,
Gareth.

(FKA gareth111)

modified on Friday, February 6, 2009 4:48 AM

AnswerRe: Fast data retrieval method? Pin
PIEBALDconsult5-Feb-09 6:31
mvePIEBALDconsult5-Feb-09 6:31 
AnswerRe: Fast data retrieval method? Pin
Pete O'Hanlon5-Feb-09 11:44
mvePete O'Hanlon5-Feb-09 11:44 
GeneralRe: Fast data retrieval method? Pin
Gareth H5-Feb-09 22:42
Gareth H5-Feb-09 22:42 
AnswerRe: Fast data retrieval method? Pin
Mark Churchill5-Feb-09 14:22
Mark Churchill5-Feb-09 14:22 
QuestionSend data from textbox to datagridview in a diferent form Pin
ZRF695-Feb-09 5:24
ZRF695-Feb-09 5:24 
AnswerRe: Send data from textbox to datagridview in a diferent form Pin
musefan5-Feb-09 6:09
musefan5-Feb-09 6:09 
GeneralRe: Send data from textbox to datagridview in a diferent form Pin
EliottA5-Feb-09 6:14
EliottA5-Feb-09 6:14 
GeneralRe: Send data from textbox to datagridview in a diferent form Pin
musefan5-Feb-09 6:21
musefan5-Feb-09 6:21 
Questionconnecting to a unix data base Pin
tasumisra5-Feb-09 5:09
tasumisra5-Feb-09 5:09 
AnswerRe: connecting to a unix data base [modified] Pin
Luc Pattyn5-Feb-09 5:14
sitebuilderLuc Pattyn5-Feb-09 5:14 
AnswerRe: connecting to a unix data base Pin
SeMartens5-Feb-09 5:15
SeMartens5-Feb-09 5:15 
GeneralRe: connecting to a unix data base Pin
tasumisra5-Feb-09 5:20
tasumisra5-Feb-09 5:20 
GeneralRe: connecting to a unix data base Pin
SeMartens5-Feb-09 5:27
SeMartens5-Feb-09 5:27 
GeneralRe: connecting to a unix data base Pin
tasumisra5-Feb-09 5:30
tasumisra5-Feb-09 5:30 
QuestionError when building the project. Pin
Priya Prk5-Feb-09 4:38
Priya Prk5-Feb-09 4:38 
AnswerRe: Error when building the project. Pin
EliottA5-Feb-09 5:05
EliottA5-Feb-09 5:05 
AnswerRe: Error when building the project. [modified] Pin
Luc Pattyn5-Feb-09 5:16
sitebuilderLuc Pattyn5-Feb-09 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.