ivan-krukov / aligning-genealogies

The genealogy-coalescent alignment project
3 stars 0 forks source link

Do not inherit directly from nx.DiGraph #1

Closed ivan-krukov closed 4 years ago

ivan-krukov commented 4 years ago

At the current stage, the Genealogical class inherits from networkx.DiGraph. When we use nx methods on the genealogy classes, it will invoke the constructor of __class__ without extra arguments. This means that at present the instance attributes of the genealogies are updated manually.

Ideally, we want to have the digraph as a member of the Genealogical class. But this will mean that some code would need to be refactored to call self.graph.

shz9 commented 4 years ago

I refactored the code as requested.

I'm not sure if we should add wrappers for the common methods such as add_node or add_edges_from so that instead of calling self.graph.add_node we can just directly call self.add_node.