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
16
votes
6 answers

Is it good practice to often use instanceof?

The scenario. I'm writting game-related code. In that game a Player(its also a class) has a list of Item. There are other types of items that inherit from Item, for example ContainerItem, DurableItem or WeaponItem. Obviously it is very conveniant…
Justas S
  • 584
  • 4
  • 12
  • 34
16
votes
3 answers

Flat PHP Array to Hierarchy Tree

I have an array with the following keys id parent_id name A sample array: array(7) { [0]=> array(3) { ["id"]=> string(1) "4" ["parent_id"]=> string(1) "0" ["name"]=> string(16) "Top Level Page 4" } [1]=> …
Tommy Arnold
  • 3,339
  • 8
  • 31
  • 40
16
votes
3 answers

how to encode this data to parent / children structure in JSON

I am working with d3.js to visualise families of animals (organisms) (up to 4000 at a time) as a tree graph, though the data source could just as well be a directory listing, or list of namespaced objects. my data looks like: json = { …
johowie
  • 2,475
  • 6
  • 26
  • 42
15
votes
3 answers

Clojure states within states within states

I'd love to hear what advice the Clojure gurus here have about managing state in hierarchies. I find I'm often using {:structures {:like {:this {:with {:many 'levels}} } } } and if I want to track changes in state at multiple levels, by throwing…
Hendekagon
  • 4,565
  • 2
  • 28
  • 43
15
votes
1 answer

CTE to traverse back up a hierarchy?

I can find all the children of a given record in a hierarchical data model (see code below) but I'm not sure how to traverse back up the Parent/Child chain with a given Child ID. Can anyone point me in the right direction to figure out how to do…
RichC
  • 7,829
  • 21
  • 85
  • 149
15
votes
8 answers

Construct flat array from tree of objects

Suppose I have a tree of objects like the following, perhaps created using the excellent algorithm found here: https://stackoverflow.com/a/22367819/3123195 { "children": [{ "id": 1, "title": "home", "parent": null, …
The DIMM Reaper
  • 3,558
  • 3
  • 28
  • 46
15
votes
3 answers

Make *ALL* Wordpress Categories use their Parent Category Template

I want to change the default template hierarchy behavior, and force all subcategory level pages that don't have their own category template file to refer to their parent category template file. In my other post, Richard M. gave an excellent answer…
Matrym
  • 16,643
  • 33
  • 95
  • 140
15
votes
2 answers

Google places API hierarchy - neighbourhood/suburb -> city -> region -> country

Problem - people posting in various places based on their interest while other people are searching for posts in greater areas. e.g. - user A posts under Bondi Beach, a suburb of Sydney. user B searches for posts under Sydney. Desired outcome - user…
giLisH
  • 196
  • 1
  • 12
15
votes
2 answers

Does ruby provide a method to show the hierarchy calls?

That's all, i want to see what are the clases that inherits a fixed class. There is a method for this in Ruby? Aptana offers an option that shows this, but is there any method? Thanks
flyer88
  • 1,073
  • 3
  • 15
  • 33
15
votes
4 answers

Java inheritance vs. C# inheritance

Let's say Java has these hierarchical classes: class A { } class B extends A { public void m() { System.out.println("B\n"); } } class C extends B { public void m() { System.out.println("C\n"); } } class D…
prosseek
  • 182,215
  • 215
  • 566
  • 871
14
votes
5 answers

Eclipse IDE. See list of all a class's inherited methods

Gonna keep this one short. Is there any way to click on the name of a class in the editor and see a list of all of its methods (inherited and otherwise) in another window? This relates to my other question here:…
Justian Meyer
  • 3,623
  • 9
  • 35
  • 53
14
votes
6 answers

Linq extension method, how to find child in collection recursive

I'm already familiar with Linq but have little understanding of extension methods I'm hoping someone can help me out. So I have this hierarchical collection pseudo code ie: class Product prop name prop type prop id prop List
sushiBite
  • 341
  • 2
  • 5
  • 16
14
votes
2 answers

Represent a tree hierarchy using an Excel spreadsheet to be easily parsed by Python CSV reader?

I have a non-technical client who has some hierarchical product data that I'll be loading into a tree structure with Python. The tree has a variable number of levels, and a variable number nodes and leaf nodes at each level. The client already…
Erich
  • 2,509
  • 2
  • 21
  • 24
14
votes
6 answers

How to set parentViewController in UIViewController?

The parentViewController property of UIViewController is readonly, but I am nesting custom view controllers and would like to use this property. However, since it is readonly, and I found no other way to set this property, my quesion is: how do I…
mrueg
  • 8,185
  • 4
  • 44
  • 66
14
votes
1 answer

SQL Server 2008 Hierarchy Data Type Performance?

How does SQL Server 2008's Hierarchy data type perform compared to using the hierarchy implementation described by Joe Celko here: http://www.intelligententerprise.com/001020/celko.jhtml? I've used Celko's method in the past with great results - but…
nikmd23
  • 9,095
  • 4
  • 42
  • 57