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

Add JSON Exporter #2674

Closed
mbastian opened this issue Oct 25, 2022 · 4 comments · Fixed by #2676
Closed

Add JSON Exporter #2674

mbastian opened this issue Oct 25, 2022 · 4 comments · Fixed by #2676
Assignees
Labels
Export Wishlist New features (not a bug)
Milestone

Comments

@mbastian
Copy link
Member

Gephi doesn't support JSON as an import/export format. We should try to fill that gap. For now, only focus on Export.

Now the essential question, is which format do we want to export to. There a few options and ultimately I think we should support all of them, or at least more than one to cover the most ground possible:

Proposed solution

Stick to the Graphology format as the first option.

Use the JSON Exporter plugin as inspiration and improve it. This was based on Sigma.js parser originally and written by @computermacgyver.

Alternatives considered

JSONLines/ndjson could also be an option, in combination with any of the format. Essentially representing the graph as a stream of nodes/edges. This wouldn't allow for graph-level configurations.

Additional context

If you're aware of any other relevant JSON graph format, let me know.

FYI @jacomyal @Yomguithereal @jacomyma

@mbastian mbastian added Wishlist New features (not a bug) Export labels Oct 25, 2022
@mbastian mbastian added this to the 0.10.0 milestone Oct 25, 2022
@mbastian mbastian self-assigned this Oct 25, 2022
@seinecle
Copy link

There is the vosviewer json file format. Not the most universal, adding it here for completeness:

https://app.vosviewer.com/docs/file-types/json-file-type/

@mbastian mbastian mentioned this issue Oct 27, 2022
8 tasks
@mbastian mbastian linked a pull request Oct 27, 2022 that will close this issue
8 tasks
@mbastian
Copy link
Member Author

Added a format combo so that we can support multiple formats down the line. For now, I just implemented Graphology one but it shouldn't be too much work to add more.
Screenshot 2022-10-28 at 21 01 05

mbastian added a commit that referenced this issue Oct 28, 2022
* Initial implementation, work in progress

* Add tests and UI

* Minor tweaks

* Do not export undirected for each edge when undirected

* Formatting

* Fix color and options
@Yomguithereal
Copy link

Regarding position, do you avoid z when all z are irrelevant (which seems to be the case in most Gephi usecases). I am asking because I often encounter gexf files having z positions even if they are all zero. But it might be something of the past, I did not check recently.

Out of curiosity, how did you choose to handle:

  1. conflicting attribute names and gexf viz namespace values?
  2. dynamics?

@mbastian
Copy link
Member Author

Regarding position, do you avoid z when all z are irrelevant (which seems to be the case in most Gephi usecases). I am asking because I often encounter gexf files having z positions even if they are all zero. But it might be something of the past, I did not check recently.

Yes, I don't export Z if irrelevant. GEXF export in Gephi does the same. Maybe some other exporters are still exporting Z.

Out of curiosity, how did you choose to handle:

  1. conflicting attribute names and gexf viz namespace values?

Good point. It could be a problem for the edge type column as in Gephi that column is called "kind". I guess we should ignore those columns and throw a warning. I'll change that.

  1. dynamics?

If the "Dynamics" checkbox is checked we serialize to string the dynamic attributes. For instance "score": "\u003c[2002.0, 4]; [2004.0, 1]; [2006.0, 2]; [2011.0, 0]; [2012.0, 4]; [2014.0, 4]\u003e". If not checked, we use the current estimator to get a single value for that column. We do the same for CSV export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Export Wishlist New features (not a bug)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants