Class GmlExporter<V,E>

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

public class GmlExporter<V,E> extends BaseExporter<V,E> implements GraphExporter<V,E>
Exports a graph into a GML file (Graph Modeling Language).

For a description of the format see https://github.com/GunterMueller/UNI_PASSAU_FMI_Graph_Drawing/blob/master/GML/gml-technical-report.pdf.

The behavior of the exporter such as whether to print vertex labels, edge labels, and/or edge weights can be adjusted using the setParameter method. When exporting labels, the exporter escapes them as Java strings.

Author:
Dimitrios Michail
  • Constructor Details

    • GmlExporter

      public GmlExporter()
      Creates a new GmlExporter object with integer id providers for the vertex identifiers.
    • GmlExporter

      public GmlExporter(Function<V,String> vertexIdProvider)
      Constructs a new GmlExporter object with the given id providers.
      Parameters:
      vertexIdProvider - for generating vertex IDs. Must not be null.
  • Method Details

    • exportGraph

      public void exportGraph(Graph<V,E> g, Writer writer)
      Exports an graph into a plain text GML format.
      Specified by:
      exportGraph in interface GraphExporter<V,E>
      Parameters:
      writer - the writer
      g - the graph
    • isParameter

      public boolean isParameter(GmlExporter.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(GmlExporter.Parameter p, boolean value)
      Set the value of a parameter of the exporter
      Parameters:
      p - the parameter
      value - the value to set