Package com.jgalgo.io

Class GraphMlGraphWriter<V,E>

java.lang.Object
com.jgalgo.io.GraphMlGraphWriter<V,E>
Type Parameters:
V - the vertices type
E - the edges type
All Implemented Interfaces:
GraphWriter<V,E>

public final class GraphMlGraphWriter<V,E> extends Object
Write a graph in 'GraphML' format.

GraphML is an XML-based format for graphs. Both directed and undirected graphs are supported, along with mixed graphs (some edges are directed while others are undirected) although the Graph does not supported mixed graphs (therefore the writer also doesn't support it). The format support graphs with vertices and edges of any type, as long as they can be written as an XML attribute string. The format also support multiple weights for vertices and edges, of type boolean, int, long, float, double or String, and a default value for each weight type.

The GraphML format support both self edges and parallel edges.

Author:
Barak Ugav
See Also:
  • Constructor Details

    • GraphMlGraphWriter

      public GraphMlGraphWriter()
      Create a new writer.
  • Method Details

    • writeGraph

      public final void writeGraph(Graph<V,E> graph, Writer writer)
      Description copied from interface: GraphWriter
      Write a graph to an I/O writer.
      Specified by:
      writeGraph in interface GraphWriter<V,E>
      Parameters:
      graph - a graph
      writer - an I/O writer to which the graph description will be written to