Skip to content
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

Web::display should accept node's list, not a dict #34

Open
junipertcy opened this issue Feb 4, 2019 · 1 comment
Open

Web::display should accept node's list, not a dict #34

junipertcy opened this issue Feb 4, 2019 · 1 comment
Assignees
Labels

Comments

@junipertcy
Copy link
Contributor

junipertcy commented Feb 4, 2019

Just another proposal:

When we want to color the nodes by their metadata, we customize the display argument in the Web class.

See the documentation: https://webwebpage.github.io/docs/examples/add_node_metadata_categorical.html

Here, the key nodes accepts a dict as its value. But it may make more sense to use list instead.

In other words, the accepted value is suggested to be:
'nodes' : [ { 'id': 0, 'cooperativity' : 'high', 'alphabeticallity' : 0, }, { 'id': 1, 'cooperativity' : 'low', 'alphabeticallity' : 1, }, { 'id': 2, 'cooperativity' : 'medium', 'alphabeticallity' : 2, } ]

This enables the data object easier to talk with the native D3.js in JavaScript. Please feel free to disagree. It’s just my own feeling.

@hneutr
Copy link
Collaborator

hneutr commented Feb 5, 2019

This seems reasonable! I also think this would make things more clear about how nodes in the edgelist are assigned metadata.

If they're strings, they're assigned to either:
a) a node with name which matches that string, or
b) no metadata

If they're 0 indexed integers, they're assigned to the value at the nodes array pointed to when treated as an index.

If they're 1 indexed integers, we treat the nodes array as "1 indexed" and they're assigned to the value at the nodes array pointed to when treated as an index.

I like the idea and there's really not much LOE here. In fact, on the python side, I think you could already do this.

I'm trying to think of whether there's a real usecase for supporting the dict behavior too.

Either way, this is easy to support and goes to the top of the todo this. (but will come out after putting out the released and then rolled back canvas upgrade 😬)

@hneutr hneutr self-assigned this Feb 5, 2019
@hneutr hneutr added the feature label Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants