FlowingData Forums » Data Visualization

Visualising a Hierarchy

Started 8 months ago by Discombobulator / 3 posts

  1. I've had a quick scan through the forum for an answer to this and haven't been able to identify one, so here I am!

    I have a dataset that describes a hierarchy:

    >Employee ID
    >Employee Name
    >Job Title
    >Reports To

    This table is recursive in that the 'Reports To' Field relates to another 'Employee ID' in that table.

    Is there a method using R or maybe Python that would be able to loop through this dataset and plot the hierarchy? Ideally I would then be able to export this as an SVG for any further graphical improvements but the key thing is that the hierarchy gets drawn out and can be exported as a vector image.

    I have briefly had a go at this but hit a wall (due to not being a very experienced programmer). I can get a for loop to whistle through the dataset and draw a circle for each employee and connect that circle with a line to it's manager. I can't however figure out how to make it draw this in a neat and orderly fashion.

    Before I went any further with this, I thought it would be prudent to check if there was already some code out there that would fulfil this. The closest I've found is a non-code method using Google Docs spreadsheet which has a pretty good hierarchy plotter in it. But it has trouble dealing with the size of what I'm throwing at it (50+ records causes half the chart to overhang the print boundary) and also it can only export in png (plus the exported diagram is still missing the chunk of the hierarchy which overhangs the print boundary).

    Does anyone know if there's a solution out there?

    Thanks

  2. Going from tables to hierarchies to visualizations is a standard CS problem:

    Here is a discussion on the problem if you store your org data in a database
    Joe Celko Hierarchical SQL
    http://onlamp.com/pub/a/onlamp/2004/08/05/hierarchical_sql.html

  3. As far as a quickfix visualization, you might consider trying Gephi (http://gephi.org/). I've only spent a little time playing with it. So, I'm not sure if you can do the traditional pyramid layout for organisational hierarchy with an addon. But, you can easily relate Node A (Employee ID) to Node B (Reports to Employee ID) in your scenario.

    If you're trying show relationships in a circular format, you might try importing your data into circos (http://circos.ca/)

    On the computer science side of things, what you have is called a "linked list." Assuming that the CEO (or whoever is at the top of the pyramid) has a reports to value of null, you can start there. Identify the top level employee, and you can start your nested loops to identify the rest of the employees.

    Can you elaborate a bit more of what you would like to see as an end result? That might help us give a better tailored answer to your question. Good luck with your visualization! =)

    -c0nsole


Reply

You must log in to post.

About this Topic