Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Recomendations for a good file format to save graph files.

by jpearl (Scribe)
on Mar 24, 2009 at 14:54 UTC ( [id://752893]=perlquestion: print w/replies, xml ) Need Help??

jpearl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I've been working with a lot of graph information lately, trying to get some good layout techniques. At the moment my perl programs can produce an n-by-n matrix of a complete graph. However I'd like to export it into a format that is easier to parse, for others not necessarily using perl. My idea is GXL However a quick search on cpan hasn't produced any results. I don't suppose anyone out there uses graphs and has a decent mod for graph file handling? (I'd prefer something XML based, but open to suggestions). Thanks!
  • Comment on Recomendations for a good file format to save graph files.

Replies are listed 'Best First'.
Re: Recomendations for a good file format to save graph files.
by moritz (Cardinal) on Mar 24, 2009 at 15:00 UTC
    A matrix can be seen as an Array of Arrays, and as such it can be easily written for example as JSON or YAML. There are plenty of Perl modules for both systems, and libraries are also available for many other languages.

    You could also use something as simple as comma separated values, so excel and other spreadsheet apps can read it easily.

      Thanks Moritz, I would probably lean towards something like JSON, mainly since I'd like to point to other modules/libraries/etc that would easily parse the data without a lot of hassle for any others trying to read the file (hey, use "org.json" you java person). My main concern is other programmers being able to easily read my file. (There are several languages at use here...) At the moment most of our data is stored in flat files that are tab-delimited. I'd like to push for a standardized format, something like XML that's got a lot of pre-constructed parsing options. And that we can store some meaningful tag information in (i.e. <undirected>, <node>, <edge>, etc). Which is why it would be great to have a format specific to graphs.
Re: Recomendations for a good file format to save graph files.
by etj (Deacon) on Jun 03, 2022 at 22:02 UTC
Re: Recomendations for a good file format to save graph files.
by blahblahblah (Priest) on Mar 25, 2009 at 00:03 UTC
    I've been pondering a similar problem lately, so I'd like to piggyback on the OP's question. We currently use a messy mix of YAML, JSON, and other homegrown formats to store various pieces of configuration data in our app. We are planning on writing a couple of features soon which depend on representing the entire system configuration in one big text file. We're leaning towards XML, because of a similar requirement to the OP's: that the file be easy to read and manipulate in languages other than Perl.

    I am slightly worried that we don't know what we're getting ourselves into, and that the one-big-file is going to wind up being just as much of a nightmare to deal with as our current hodgepodge of separate files. Can anyone suggest good resources for reading up on this? Is there a public library of standard XML formats, so that we won't have to re-invent the wheel? Is a well-designed DTD our magical answer for other languages? Has anyone traveled a similar path and learned any good lessons?

    Thanks, Joe

Re: Recomendations for a good file format to save graph files.
by zentara (Archbishop) on Mar 25, 2009 at 12:35 UTC
    Hi, google for "PDL maillist", join, and ask there. There are some special formats it has for storing astronomical data as matrix...2x2 grid of pixels. So you can use PDL and it's helper modules.

    I'm not really a human, but I play one on earth My Petition to the Great Cosmic Conciousness

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://752893]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found