New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING CHANGES] Clean up adjacency and related methods #94
Conversation
Codecov Report
@@ Coverage Diff @@
## main #94 +/- ##
==========================================
- Coverage 61.62% 61.44% -0.19%
==========================================
Files 22 22
Lines 2541 2534 -7
==========================================
- Hits 1566 1557 -9
- Misses 975 977 +2
|
I would argue that two separate functions (e.g., Additionally, that would resolve the issue with the default value, as the consumer is forced to actively choose between both. |
That being said, isn't that what |
@ffl096 I think you're right, thanks. I'll update the code accordingly. |
Thanks! A few questions @josefhoppe
I'm puzzled with flake8-docstrings is not picking up on the docstring formatting: docstrings should start with verb in imperative mode, which is not respected in one of your test files. |
test/utils/test_structure.py
Outdated
@@ -109,6 +112,37 @@ def test_sparse_array_to_neighborhood_dict(self): | |||
) | |||
assert output == d | |||
|
|||
def test_incidence_to_adjacency(self): | |||
""" | |||
Tests incidence to adjacency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix Docstrings formatting:
- Summary should fit on one line directly after """.
- Summary should start with a verb in infinitve mode --> Test
toponetx/algorithms/spectrum.py
Outdated
"""Return eigenvalues of the Laplacian of G. | ||
|
||
Parameters | ||
---------- | ||
matrix : scipy sparse matrix | ||
weight : str or None, optional (default='weight') | ||
If None, then each cell has weight 1. | ||
up : bool, default False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docstrings does not follow the signature of the function.
Maybe I misunderstood you. I included it in #40 as it existed in mostly the same form in both CombinatorialComplex and CellComplex and you said you generally agreed with de-duplicating code (now that I think of it, that could also be a reference to other de-duplications). Either way, I still think that it makes sense to move it to the utility package, but if you disagree we can also revert that change.
Does it? Nodes (0-cells) are upper adjacent to each other via edges (1-cells), aren't they? Regarding the doc strings: Thanks for catching that, I'll fix the ones you pointed out. |
the duplication issue between many complexes is indeed a problem. NetworkX does not attach the adjacency matrix as a graph method but rather as a part of the linear algebra module : same for the incidence matrix. I am not sure we can do that for all complexes though since the parameters might differ (CC for instance takes two arguments). |
lower_adjacency_matrix and upper_adjacency_matrix are the same thing as adjacency matrix and coadjacency matrix. Reason why I kept adjacency and coadjacency matrix is to be consist with graphs when the rank is zero. I am not sure if our output convention matches that of networkx's adjacnecy matrix but preferably so. |
As we discussed, I moved
_incidence_to_adjacency
to the utility package. I also cleaned up duplicate adjacency methods inCellComplex
, resulting in breaking changes.s
breaks anything as it didn't work beforenode_ajacency_matrix
andcell_adjacency_matrix
will inevitably break something (they could be re-added as proxy methods foradjacency_matrix
if you prefer)adjacency_matrix
: Currently, the default is to use the lower adjacency. For rank 0, this does not really make sense. I'm not sure what I prefer: