How to model government organization hierarchies so that the list can expand and compress

Denis McMahon denismfmcmahon at gmail.com
Sat Aug 15 18:51:17 EDT 2015


On Thu, 13 Aug 2015 12:10:12 -0700, Alex Glaros wrote:

> What would the data model look like for this?

Define an organizational unit. Give it a unique name. Give it a list of 
superiors and a list of subordinates.

government = {

'president' : { 'superiors' : [], 'subordinates' : ['jcs', 'cia', 'fbi', 
'nsa', 'treasury', 'nasa' ..... ] },

'jcs' : { 'superiors': ['president', 'congress', 'senate', 'treasury'], 
'subordinates' : ['army', 'navy', 'air force', 'jsoc'] }, 

'navy' : { 'superiors' : ['jcs', 'nsa', 'cia'], 'subordinates' : 
['seals', 'marines', 'pacific fleet' ....] }, ........

}

The multiple parenting means that you need to use something as 
references. You can't represent the hierarchy as a simple tree, because 
in a simple tree a node only has one parent.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list