igraph / igraph

Library for the analysis of networks
https://igraph.org
GNU General Public License v2.0
1.74k stars 405 forks source link

Feature Request: Import/Export graph as JSON #957

Closed geofurb closed 2 years ago

geofurb commented 8 years ago

It would be nice if we could import and export graphs in JSON node-link format per: http://bl.ocks.org/mbostock/4062045

szhorvat commented 8 years ago

The question is: What software uses this specific format? Is it widely used?

It shouldn't be difficult to produce JSON form an igraph graph with any of the high-level interfaces. With Mathematica it was just a few lines even 3 years ago and now it should be simpler still.

There are many different ways to encode a graph into JSON. Does it make any sense to create an exporter just for one type of representation unless it is widely used by many different tools?

geofurb commented 8 years ago

This is the most flexible format for import/export in the very popular Python graph library, NetworkX.

szhorvat commented 8 years ago

Is it fully documented anywhere? Is there any other software than NetworkX which uses this specific encoding into JSON?

spth commented 7 years ago

I'd also like to see support for reading json graphs.

In particular, my use case would be to read a graph representation of OpenStreetMap (OSM) data with igraph. Clearly parsing OSM data formats (.osm, or .o5m or .pbf) is beyond the scope of igraph. But there is a tool for converting osm data to json graphs (https://github.com/rovaniemi/osm-graph-parser), so being able to read json graphs into igraph would help.

I think OSM is a rather important source for graph data, so others also might be interested in having this capability in igraph.

Philipp

ntamas commented 7 years ago

The JSON format that @spth refers to is completely different from the JSON format that NetworkX uses and that @geofurb refers to. The key problem here is that there is no standard representation of graphs in JSON format (as far as I know), so everyone makes up their own representation. Creating a single JSON parser for graphs is simply not possible at this stage - if we already had one based on, say, the format that was shown on the page in @geofurb's comments, it could not have been used to parse JSON files in the format shown by @spth.

aourednik commented 6 years ago

D3.js is the most used js-based visualisation framework in my experience; i would vote for d3-js format(s). There are two of them : non-hierarchical and tree. Cytoscape exports to both. There already seems to be an igraph_to_networkD3 function written in R: https://github.com/christophergandrud/networkD3/blob/master/R/utils.R Integrating both graph exports to D3 directly in igpraph would be great.

szhorvat commented 2 years ago

I vote for closing this issue, for the following reasons:

I'll let the stale bot close this if there is no further interaction.

szhorvat commented 2 years ago

http://jsongraphformat.info/ is an effort to standardize graph representations in JSON, but it's unclear how widely adopted it is.

Implementing readers/writers is still better in high-level interfaces though, all of which already support JSON.

ntamas commented 2 years ago

gravis also uses a different JSON format. I don't think that there will be a "standard" JSON graph format anywhere in the near-term.

szhorvat commented 2 years ago

Actually, I found http://jsongraphformat.info/ through gravis: it uses a sub-format of the JGF specification. But I'm not sure how feasible it is to create a parser that can read any sub-format. This should be researched. Anyway, this is not a priority. If we decide that we want the JSON reader after all, I suggest writing up "good first issues" for the high-level interfaces and implementing it there.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.