Creating GEXF files from GraphX graphs

To connect the graph visualization capabilities of Gephi with Spark GraphX graphs, we need to address a way to communicate between the two. The canonical candidate for doing so is Gephi's Graph Exchange XML Format (GEXF), a description of which can be found at https://gephi.org/gexf/format/. A very simple example of how graphs are described in this format is displayed in the following code listing:

<?xml version="1.0" encoding="UTF-8"?><gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">    <meta lastmodifieddate="2009-03-20">        <creator>Gexf.net</creator>        <description>A hello world! file</description>    </meta>    <graph mode="static" defaultedgetype="directed">        <nodes>            <node id="0" label="Hello" /> <node ...

Get Mastering Machine Learning with Spark 2.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.