Questions tagged [hierarchy]

For issues relating to creating, maintaining, or displaying a hierarchy of data or resources, etc.

A hierarchy is an arrangement of items (objects, names, values, categories, resources, etc.) in which the items are represented as being "above," "below," or "at the same level as" one another. Abstractly, a hierarchy is simply an ordered set or an acyclic directed graph.

A hierarchy can link entities either directly or indirectly, and either vertically or horizontally. The only direct links in a hierarchy, insofar as they are hierarchical, are to one's immediate superior or to one of one's subordinates, although a system that is largely hierarchical can also incorporate alternative hierarchies. Indirect hierarchical links can extend "vertically" upwards or downwards via multiple links in the same direction, following a path. All parts of the hierarchy which are not linked vertically to one another nevertheless can be "horizontally" linked through a path by traveling up the hierarchy to find a common direct or indirect superior, and then down again.

2838 questions
35
votes
5 answers

How should a REST URL schema look like for a tree hierarchy?

Let's assume that I have stores, shelves in a store, and products on a shelf. So in order to get a list of products on a shelf in a store, I'd use the following request: GET http://server/stores/123/shelves/456/products From here, how would I get…
Daniel T.
  • 37,212
  • 36
  • 139
  • 206
33
votes
3 answers

Maven naming conventions for hierarchical multiple module projects

I've got a question on Maven naming conventions (groupId, artifactId and directory names) in a multiple module project with a hierarchical directory structrure. Research Before asking, I went through other the web on this topic and what I cleared…
d1e
  • 6,372
  • 2
  • 28
  • 41
29
votes
3 answers

Get all parents for a child

I want to retrieve the parentid of an id, if that parentid has a parent again retrieve it, and so on. Kind of hierarchy table. id----parentid 1-----1 5-----1 47894--5 47897--47894 am new to sql server and tried, some queries like: with name_tree as…
srinioracle
  • 301
  • 1
  • 3
  • 11
28
votes
3 answers

Setting property value on child instance to a fixed value with Autofixture

Is it possible to assign a fixed value to a property on a child instance when building a parent with Autofixture? It will add default values to all the properties on the child instance like a charm, but I would like to override and assign a specific…
Jens Andresen
  • 283
  • 1
  • 3
  • 6
28
votes
2 answers

How to use enum with grouping and subgrouping hierarchy/nesting

I have one enum 'class' called Example as follows: enum Example { //enums belonging to group A: enumA1, enumA2, enumA3, //enums belonging to group B: enumB1, enumB2, enumB3, //enums belonging to group C: enumC1, enumC2, …
user2763361
  • 3,789
  • 11
  • 45
  • 81
28
votes
3 answers

How can I split my javascript code into separate files?

I'm reading the Javascript Guide from Mozilla And when they contrasted JS to Java , It got me thinking, Java code is easily split up with each class in his own file. after futher search , I understand that the same can be accomplished in JS with…
MimiEAM
  • 2,505
  • 1
  • 26
  • 28
27
votes
2 answers

Construct hierarchy tree from flat list with parent field?

I have a list of "page" objects with a parent field. This parent field references another object in the list. I would like to create a tree hierarchy from this list based on this field. Here is what my original list looks like: [ { id: 1, …
TruMan1
  • 33,665
  • 59
  • 184
  • 335
23
votes
7 answers

C# algorithm for generating hierarchy

I've got a text file that looks like this: { Id = 1, ParentId = 0, Position = 0, Title = "root" } { Id = 2, ParentId = 1, Position = 0, Title = "child 1" } { Id = 3, ParentId = 1, Position = 1, Title = "child 2" } { Id = 4, ParentId = 1, Position =…
Judah Gabriel Himango
  • 58,906
  • 38
  • 158
  • 212
23
votes
1 answer

Implementing NSCopying in Subclass of Subclass

I have a small class hierarchy that I'm having trouble implementing copyWithZone: for. I've read the NSCopying documentation, and I can't find the correct answer. Take two classes: Shape and Square. Square is defined as: @interface Square :…
Craig Otis
  • 31,257
  • 32
  • 136
  • 234
23
votes
6 answers

Building hierarchy objects from flat list of parent/child

I have a list of items in a hierarchy, and I'm attempting to parse this list out into an actual hierarchy of objects. I'm using modified pre-order tree traversal to store/iterate through this list, and so what I have is a subset of the tree,…
gregmac
  • 24,276
  • 10
  • 87
  • 118
23
votes
2 answers

Counting number of children in hierarchical SQL data

for a simple data structure such as so: ID parentID Text Price 1 Root 2 1 Flowers 3 1 Electro 4 2 Rose 10 5 2 Violet 5 6 4 Red Rose …
Dennis G
  • 21,405
  • 19
  • 96
  • 133
23
votes
2 answers

Smooth transitioning between tree, cluster, radial tree, and radial cluster layouts

For a project, I need to interactively change hierarchical data layout of a visualization - without any change of the underlying data whatsoever. The layouts capable of switching between themselves should be tree, cluster, radial tree, and radial…
VividD
  • 10,456
  • 6
  • 64
  • 111
22
votes
5 answers

Getting hierarchy data from self-referencing tables

Let's say you have the following table: items(item_id, item_parent) ... and it is a self-referencing table - item_parent refers to item_id. What SQL query would you use to SELECT all items in the table along with their depth where the depth of…
Emanuil Rusev
  • 34,563
  • 55
  • 137
  • 201
21
votes
5 answers

LINQ sort a flat list based on childorder

I am currently trying to figure out a good way to sort my elements with LINQ and C#, but I am kinda failing to do so. For the problem let assume you have the following Table ---TempTable ID (int) ParentID (int) Name (varchar) SortOrder (int) The ID…
Rand Random
  • 7,300
  • 10
  • 40
  • 88
19
votes
7 answers

Is it possible to create a recursive query in Access?

I have a job table Id ParentID jobName jobStatus The root ParentID is 0. Is it possible in Access to create a query to find a root for a given job? The database is MDB with no linked tables. The Access version is 2003. A job can be several levels…
THEn
  • 1,920
  • 3
  • 28
  • 35