monarch-initiative / phenol

phenol: Phenotype ontology library
https://phenol.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 4 forks source link

Implement mono graph #448

Closed ielis closed 10 months ago

ielis commented 10 months ago

The PR adds org.monarchinitiative.phenol.graph.csr.mono.CsrMonoOntologyGraph, an implementation of an OntologyGraph that stores just one edge type in a CSR-like structure. CsrMonoOntologyGraph becomes the default implementation used in Ontology and MinimalOntology that are loaded by phenol-io.

It fixes #444 since the graph only stores one edge type, which is what we need for most of our current work anyway.

Next, the PR sets up benchmarks using Java Mircrobenchmark Harness. The benchmark shows a significant performance improvement for getting parents and children of a term.

@julesjacobsen do you think you can skim CsrMonoOntologyGraph and the benchmark setup if they look reasonable? The biggest performance gain was actually achieved by using a Map to get index of a node instead of the binary search.. The performances of the ancestor/descendant traversals are not too impressive though. I am not sure if/how these can be improved, at least without a lot of work.

My overall aim is to wrap as many loose ends on Phenol as possible and make this, hopefully, also useful to you. So, if I will appreciate any comments if you have some time for this..

Thanks a lot!