[SOLVED] Exporting graph to Gexf format (String not File)

Get help with your data
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
User avatar
ppareja
Posts:10
Joined:15 Apr 2011 10:31
Location:Granada, Spain
Contact:
[SOLVED] Exporting graph to Gexf format (String not File)

Post by ppareja » 15 Apr 2011 10:38

Hi all!

I'm new using the Gephi Toolkit and I have to say it's really cool having so many possibilities by using the API programmatically instead of the app.

However, I've already been a while looking for a method/way to export a graph to its corresponding gexf format String instead to a File.
Does such a method exists?
How could I do that if not? (exporting it to a File and subsequently reading that file doesn't seem to me like a good option...)
Thanks in advance,

Cheers.

Pablo Pareja

User avatar
mbastian
Gephi Architect
Posts:728
Joined:10 Dec 2009 10:11
Location:San Francisco, CA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Exporting graph to Gexf format (String not File)

Post by mbastian » 16 Apr 2011 03:52

Yeah you can totally do that, check an example on this page

Code: Select all

Exporter exporterGraphML = ec.getExporter("graphml");     //Get GraphML exporter
exporterGraphML.setWorkspace(workspace);
StringWriter stringWriter = new StringWriter();
ec.exportWriter(stringWriter, (CharacterExporter) exporterGraphML);
System.out.println(stringWriter.toString());
This is with GraphML format, just change with GEXF.

User avatar
ppareja
Posts:10
Joined:15 Apr 2011 10:31
Location:Granada, Spain
Contact:

Re: Exporting graph to Gexf format (String not File)

Post by ppareja » 24 Apr 2011 15:19

Thanks! ;)

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable