Class GEXFExporter<V,E>

java.lang.Object
org.jgrapht.nio.BaseExporter<V,E>
org.jgrapht.nio.gexf.GEXFExporter<V,E>
Type Parameters:
V - the graph vertex type
E - the graph edge type
All Implemented Interfaces:
GraphExporter<V,E>

public class GEXFExporter<V,E> extends BaseExporter<V,E> implements GraphExporter<V,E>
Exports a graph as GEXF (Graph Exchange XML Format).

For a description of the format see https://gephi.org/gexf/format/schema.html. A nice primer for the format is located at https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf.

Author:
Dimitrios Michail
  • Constructor Details

    • GEXFExporter

      public GEXFExporter()
      Constructs a new exporter with integer id providers for the vertices and the edges.
    • GEXFExporter

      public GEXFExporter(Function<V,String> vertexIdProvider, Function<E,String> edgeIdProvider)
      Constructs a new exporter.
      Parameters:
      vertexIdProvider - for generating vertex identifiers. Must not be null.
      edgeIdProvider - for generating edge identifiers. Must not be null.
  • Method Details

    • isParameter

      public boolean isParameter(GEXFExporter.Parameter p)
      Return if a particular parameter of the exporter is enabled
      Parameters:
      p - the parameter
      Returns:
      true if the parameter is set, false otherwise
    • setParameter

      public void setParameter(GEXFExporter.Parameter p, boolean value)
      Set the value of a parameter of the exporter
      Parameters:
      p - the parameter
      value - the value to set
    • registerAttribute

      public void registerAttribute(String name, GEXFExporter.AttributeCategory category, GEXFAttributeType type)
      Register a GEXF Attribute
      Parameters:
      name - the attribute name
      category - the attribute category
      type - the attribute type
    • registerAttribute

      public void registerAttribute(String name, GEXFExporter.AttributeCategory category, GEXFAttributeType type, String defaultValue)
      Register a GEXF Attribute
      Parameters:
      name - the attribute name
      category - the attribute category
      type - the attribute type
      defaultValue - default value
    • registerAttribute

      public void registerAttribute(String name, GEXFExporter.AttributeCategory category, GEXFAttributeType type, String defaultValue, String options)
      Register a GEXF Attribute
      Parameters:
      name - the attribute name
      category - the attribute category
      type - the attribute type
      defaultValue - default value
      options - the possible options
    • unregisterAttribute

      public void unregisterAttribute(String name, GEXFExporter.AttributeCategory category)
      Unregister a GraphML-Attribute
      Parameters:
      name - the attribute name
      category - the attribute category
    • getCreator

      public String getCreator()
      Get the creator for the meta field.
      Returns:
      the creator for the meta field
    • setCreator

      public void setCreator(String creator)
      Set the creator for the meta field.
      Parameters:
      creator - the creator for the meta field
    • getKeywords

      public String getKeywords()
      Get the keywords for the meta field.
      Returns:
      the keywords for the meta field
    • setKeywords

      public void setKeywords(String keywords)
      Set the keywords for the meta field.
      Parameters:
      keywords - the keywords for the meta field
    • getDescription

      public String getDescription()
      Get the description for the meta field.
      Returns:
      the description for the meta field
    • setDescription

      public void setDescription(String description)
      Set the description for the meta field.
      Parameters:
      description - the description for the meta field
    • exportGraph

      public void exportGraph(Graph<V,E> g, Writer writer)
      Exports a graph in GraphML format.
      Specified by:
      exportGraph in interface GraphExporter<V,E>
      Parameters:
      g - the graph
      writer - the writer to export the graph
      Throws:
      ExportException - in case any error occurs during export