Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 636181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:29:14+00:00 2026-05-13T20:29:14+00:00

Ive got some data (not that the data actually exists until after I solved

  • 0

Ive got some data (not that the data actually exists until after I solved this…) I need to be able to manipulate within my program. However I cant work out a suitable structure for storing this in.

The data represents a set of paths and nodes. There is one input (which may in some cases no be present) then a number of paths between nodes ending with outputs (an end may not have an output, but an output is always at the end). Each input, node and output has a position, and the data overall can be manipulated graphically, so whatever structure I use needs to be easy to change the contents of at runtime in potentially unpredictable ways (such as changing the input to an output, and then making another output the input).

I considered using a tree structure where each item had a parent (except root) and a number of children, eg like:

Input
|
node---
|  |  |
|  |  Output
|  |
|  Node---Output
|  |---Output
|
Node----Node
|        |
Node     Output    

However I can see a number of problems with this such as if there is no input, or its removed / changed / etc…

This is a visual example. The > is an input O nodes and [] outputs.
http://unisonmodules.co.uk/wjnewbery/data.png

@Everyone suggesting using a tree structure like I already mentioned

If a tree is in fact suitable, how do I overcome the issues where a given set of data doesn’t even have an input/root, like say the one below. What happens then? Do I need to totally rebuild the tree if the input node/point/whatever changes (via a remove then add)? How do I do that?

http://unisonmodules.co.uk/wjnewbery/data2.png

I’ll take a look at graphs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:29:14+00:00Added an answer on May 13, 2026 at 8:29 pm

    Seems you should really need more freeform structure than a tree.
    Each node can have a number of nodes connected to it; each connection has a direction. Any node can have input or output attached. Enforcing no circular connections and only one input would be up to you upon tree creation and update.

    The structures could be multiply linked lists and go like this:

                struct Node {
                  NodeContentType type;  //Input, Output, None.
                  InOutNode* content;    //pointer to input or output
                  Link* links;           //pointer to first connection (if any), NULL if none.
                }
    
                struct Link {
                  Node* node;  //node this connection links to.
                  Link* next;  //pointer to next connection
                }
    

    Example tree:

     INPUT
     |
     root
     |
     branch1---leaf2---output2
     |
     leaf1
     |
     output1
    

    could go like this: (order is obviously wrong…)

                Node root    = { Input, &input_function, &link1 };
                Link link1   = { &branch1, NULL };
                Node branch1 = { None,  NULL, &link2 };
                Link link2   = { &leaf1, &link3 };
                Link link3   = { &leaf2, NULL };
                Node leaf1   = { Output, &output_function1, NULL };
                Node leaf2   = { Output, &output_function2, NULL };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The BCC addresses are not stripped off at the destination… May 14, 2026 at 6:54 pm
  • Editorial Team
    Editorial Team added an answer As Matthew says, building a principal and setting it yourself… May 14, 2026 at 6:54 pm
  • Editorial Team
    Editorial Team added an answer When aggregating, SQL requires any value in a field either… May 14, 2026 at 6:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.