singa-bio / singa

:leaves: SiNGA (Simulation of Natural Systems using Graph Automata) is an open-source library containing tools especially for structural bioinformatics and systems biology.
MIT License
8 stars 2 forks source link

implement touching edges for graph nodes #84

Closed fkaiserbio closed 5 years ago

fkaiserbio commented 5 years ago

We should think about a way to implement a method getTouchingNodes() for an AbstractNode.

The behavior should be as follows:

@cleberecht After careful consideration and study of the Bonnici paper, I think this is the most elegant way towards resolving issue #82. I am not entirely sure whether this works, but its worth a try. If you find time, please implement this in a feature branch, forked from current version of development branch. You are more into the design of the core graph implementation than me. Then, I will give it a try to resolve issue #82.

cleberecht commented 5 years ago

Sorry I'm a bit late to the party. Thank you for considering to fix #82. I will have a look at this.

cleberecht commented 5 years ago

I have added the requested method to the Graph interface getTouchingNodes(NodeType node) as default. It is not possible to implement this on node level since implementations are not required to hold references to their containing graph. Since getting touching nodes required traversal of edges of the graph, the method can only be implemented on a level where the edges are known in any case. Obviously, this has has a higher runtime than getting the actual neighbours for most implementations, so use this only if it is actually required. Hope this helps :)

fkaiserbio commented 5 years ago

Thank you! Directed graph isomorphism should now be supported as of be54129 😍