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

Accept iterables? #178

Open
Fil opened this issue Aug 28, 2020 · 0 comments
Open

Accept iterables? #178

Fil opened this issue Aug 28, 2020 · 0 comments

Comments

@Fil
Copy link
Member

Fil commented Aug 28, 2020

Use case:

  • a list of top scientific journals, yearly data such as citation index, etc.
  • links are certain similarities (same publisher, same domain area…)

It would be nice to write:

const group = d3.group(data, d => d.title)
simulation.nodes(group)

and have 1 node per title, indexed with the title.

This is easy to do currently with nodes(d3.groups(…)), accepting an iterable form would be a simple addition of Array.from(), as shown in this notebook which groups the Misérables by the group id: https://observablehq.com/d/ea47e3f4c38082e0

We could have something similar for links, although it's not clear to me yet how:

simulationLinks.links(d3.rollup(groups, v => v.map(d => d.title), d => d.publisher))
to group titles that have a common publisher (it's not 1-to-1 links in this case).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant