Class MatrixExporter<V,​E>

  • Type Parameters:
    V - the graph vertex type
    E - the graph edge type
    All Implemented Interfaces:

    public class MatrixExporter<V,​E>
    extends BaseExporter<V,​E>
    implements GraphExporter<V,​E>
    Exports a graph to a plain text matrix format, which can be processed by matrix manipulation software, such as MTJ or MATLAB.

    The exporter supports three different formats, see MatrixExporter.Format.

    Charles Fry, Dimitrios Michail
    See Also:
    • Constructor Detail

      • MatrixExporter

        public MatrixExporter​(MatrixExporter.Format format)
        Creates a new MatrixExporter with integer name provider for the vertex identifiers.
        format - format to use
      • MatrixExporter

        public MatrixExporter​(MatrixExporter.Format format,
                              Function<V,​String> vertexIdProvider)
        Creates a new MatrixExporter.
        format - format to use
        vertexIdProvider - for generating vertex identifiers. Must not be null.
    • Method Detail

      • getFormat

        public MatrixExporter.Format getFormat()
        Get the format that the exporter is using.
        the output format
      • setFormat

        public void setFormat​(MatrixExporter.Format format)
        Set the output format of the exporter
        format - the format to use
      • exportGraph

        public void exportGraph​(Graph<V,​E> g,
                                Writer writer)
                         throws ExportException
        Description copied from interface: GraphExporter
        Export a graph using the given Writer.

        It is the callers responsibility to ensure the Writer is closed after this method returned.

        Specified by:
        exportGraph in interface GraphExporter<V,​E>
        g - the graph to export
        writer - the output writer
        ExportException - in case any error occurs