-
Notifications
You must be signed in to change notification settings - Fork 62
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
Multiple/nested morph()
calls?
#145
Comments
If it's any help, morphed graph are lists (in most cases at least), so I tried running the nested morph on the list elements. However this fails when unmorphing because of the way the merge back to the original data is made (multiple/overwritten .tidygraph_node_index / .tidygraph_edge_index aren't handled)
|
Also tried the following approach in my case – nested morph to subgraph filtering on edges and then on nodes – by making my own morpher. In theory the morpher uses multiple calls to convert, which apply the filters (losing info but that's okay), wrapped in a morph/unmorph which makes sure we don't actually losing info.
|
Get it to work by manually protecting the index columns. Not very pretty.
|
Not exactly pretty, but you've provided some nice insight into how to think about this. Thanks for taking the time to explain, @gregleleu! |
Sure.
On that last point, maybe just not letting subsequent morphs overwrite indexes is enough (and would make sense) but I'm not familiar enough with the internals of the package to know if that 100% works. One caveat: the initial graph stays as an attribute to subsequent morphs, so it could get very big. |
Hello,
I'd like to temporarily convert a directed graph to a simple, undirected graph. I attempted this with the following code:
However, this doesn't seem to work. (The documentation does not indicate that it should work, but it seemed worth a try.)
The code below does the trick by using
convert
twice. But since this is the kind of use casemorph
specifically addresses, it feels more like a workaround than a proper solution.Is there a better way to conduct multiple morphs? And if not, might this be considered in a future update?
The text was updated successfully, but these errors were encountered: