I’m having trouble writing an algo that can read a CSV of employee/managers, and output a directed graph featuring the employee/manager relationships.
My foobar example: given the following CSV file
How can I build a DiGraph such that the following organizational structure can be shown:
/ / \
tim felisa ray
/ \ / / \
bob jim pam ben james
/ / \
mike rashad henry
Obviously this is a graph problem, but I’m having trouble deciding which structure(s) to use (e.g., would it be best to use a
dict or to build a custom
OrganizationalGraph object, etc). Any help is appreciated.
The language of choice isn’t really important (though we can just say Python for simplicity [updated tags accordingly]), I’m more so just trying to understand the fundamentals of this type of problem (i.e., recursion vs. iteration, using
set() to store a manager’s direct reports vs using only abstracted data structures). Finally, no, using any package outside of the standard library is a non-starter.