-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add weights to export by default #7
Conversation
Thanks for your PR, much appreciated 👍 Unfortunately, this currently causes the tests to fail. See also graphp/graph#114 and #5. |
Hmm.. OK, not sure what your PHPUnit tests are aiming to assert/accomplish, but the GraphML output by this change conforms to the specification... |
Didn't mean to discourage your contribution, this PR is much appreciated 👍 The test exports the graph and then imports it again and tries to assert the imported graph looks exactly like the original one. You're (correctly) exporting the weight to a GraphML key, but upon importing it does not end up in the edge weight but instead as an edge attribute. Hence the link to the first issue, as the weight properties etc. will be removed in a future version. Your code currently always exports the weight even if it is not set. This means the existing code always imports an empty attribute for these GraphML keys. What do you think about this? |
What is your intent in moving to attributes in a future version? Will the getWeight/setWeight be deprecated at some point? My suggestion would be that a) the underlying storage most closely represents what GraphML actually does (i.e. any kind of mapped key for weights) and b) that you not break backward-compatibility with existing implementations of getWeight/setWeight. So, if you are already doing this, sounds like just the Importer needs to be changed to be symmetrical with the Exporter. With a default value set, blank weight should in theory work. For better tidiness, it would be nice if there were a method like The packages currently do everything I need them to do (thank you) for exporting GraphML and rendering dot images, so I'd be reticent to upgrade if a future version broke backward compatibility with the current methods for manipulating weights. |
See graphp/graph#114 for why we would like to remove GraphML does support arbitrary attributes. And so do we. The above ticket will make sure we do no longer store any "special properties" but will instead consistently use our attribute store. In this case, we can simply loop over all existing attributes for each edge and then export this to GraphML. |
It seems to me that retaining getWeight/setWeight as an interface to the While GraphML stores weights as an arbitrary attribute in representation, So, I think there is a big difference between whether a variable is Again, the package seems fairly feature-complete to me, so if a future On 14 July 2016 at 10:45, Christian Lück notifications@github.com wrote:
|
I think you're raising some very valid points here. May I ask you to post this on graphp/graph#114 instead? |
Cross-posted here: On 14 July 2016 at 18:56, Christian Lück notifications@github.com wrote:
|
This update adds weights using the graphml specification key/data format.