nxviz
nxviz copied to clipboard
Node positions array/dict for post processing
I really like the visuals of the nxviz graphs over some of the networkx ones. However, in networkx I can easily access the node positions to add some additional annotations to the nodes, since the process requires me add their location explicitly. Could that be a thing for nxviz too?
Totally! It’s exposed right now as the node_coords attribute of each plot. It’s currently a dictionary, in which I store two lists as values: one for x-coordinates, and the other for y-coordinates.
However, I think you’re looking for an alternative implementation, something like a two-tuple as values for each node as keys. Is that right?
Oh, that is exposed? Yeah, I was looking for an alternative implementation, but that is perfect too. In case you would be interested in an extension with a node_coord_dict or something, I can check if I can do that too. I need to be able to ask for a node identifier (node_label or similar) and then get x,y coords from that.
On Sat, Feb 17, 2018 at 1:03 PM Eric Ma [email protected] wrote:
Totally! It’s exposed right now as the node_coords attribute of each plot. It’s currently a dictionary, in which I store two lists as values: one for x-coordinates, and the other for y-coordinates.
However, I think you’re looking for an alternative implementation, something like a two-tuple as values for each node as keys. Is that right?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericmjl/nxviz/issues/257#issuecomment-366436836, or mute the thread https://github.com/notifications/unsubscribe-auth/AC97q0tDROCVqRvMsjHhqSC1JDHamwQcks5tVsATgaJpZM4SIjqM .
Ah, I forgot to mention in my previous comment (blame it on typing on the phone) that the coordinates are indexed in the same order as each plot object's .nodes attribute.
Definitely interested in a node_coord_dict extension! Do let me know what you're thinking. One idea that comes to mind is to implement it as a @property - so that the dictionary is not stateful but computed on the fly from node_coords and nodes, yet from the API perspective it looks like any other 'static' attribute.
Sounds great! No worries, I think I understood what you meant. I will look into how networkx coords_dict is structured and then comeback and propose something with a PR.
On Sun, Feb 18, 2018, 06:00 Eric Ma [email protected] wrote:
Ah, I forgot to mention in my previous comment (blame it on typing on the phone) that the coordinates are indexed in the same order as each plot object's .nodes attribute https://github.com/ericmjl/nxviz/blob/master/nxviz/plots.py#L231.
Definitely interested in a node_coord_dict extension! Do let me know what you're thinking. One idea that comes to mind is to implement it as a @property - so that the dictionary is not stateful but computed on the fly from node_coords and nodes, yet from the API perspective it looks like any other 'static' attribute.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericmjl/nxviz/issues/257#issuecomment-366492851, or mute the thread https://github.com/notifications/unsubscribe-auth/AC97q-ELodEgusjmhtlHfO4Mv4nadrhwks5tV65PgaJpZM4SIjqM .