Class PajekNetWriter<V,​E>


  • public class PajekNetWriter<V,​E>
    extends java.lang.Object
    Writes graphs in the Pajek NET format.

    Labels for vertices, edge weights, and vertex locations may each optionally be specified. Note that vertex location coordinates must be normalized to the interval [0, 1] on each axis in order to conform to the Pajek specification.

    Author:
    Joshua O'Madadhain, Tom Nelson - converted to jung2
    • Constructor Summary

      Constructors 
      Constructor Description
      PajekNetWriter()
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void save​(Graph<V,​E> g, java.io.Writer w)
      Saves the graph to the specified writer.
      void save​(Graph<V,​E> g, java.io.Writer w, com.google.common.base.Function<V,​java.lang.String> vs, com.google.common.base.Function<E,​java.lang.Number> nev)
      Saves the graph to the specified writer.
      void save​(Graph<V,​E> graph, java.io.Writer w, com.google.common.base.Function<V,​java.lang.String> vs, com.google.common.base.Function<E,​java.lang.Number> nev, com.google.common.base.Function<V,​java.awt.geom.Point2D> vld)
      Saves the graph to the specified writer.
      void save​(Graph<V,​E> g, java.lang.String filename)
      Saves the graph to the specified file.
      void save​(Graph<V,​E> g, java.lang.String filename, com.google.common.base.Function<V,​java.lang.String> vs, com.google.common.base.Function<E,​java.lang.Number> nev)
      Saves the graph to the specified file.
      void save​(Graph<V,​E> g, java.lang.String filename, com.google.common.base.Function<V,​java.lang.String> vs, com.google.common.base.Function<E,​java.lang.Number> nev, com.google.common.base.Function<V,​java.awt.geom.Point2D> vld)
      Saves the graph to the specified file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PajekNetWriter

        public PajekNetWriter()
        Creates a new instance.
    • Method Detail

      • save

        public void save​(Graph<V,​E> g,
                         java.lang.String filename,
                         com.google.common.base.Function<V,​java.lang.String> vs,
                         com.google.common.base.Function<E,​java.lang.Number> nev,
                         com.google.common.base.Function<V,​java.awt.geom.Point2D> vld)
                  throws java.io.IOException
        Saves the graph to the specified file.
        Parameters:
        g - the graph to be saved
        filename - the filename of the file to write the graph to
        vs - mapping from vertices to labels
        nev - mapping from edges to weights
        vld - mapping from vertices to locations
        Throws:
        java.io.IOException - if the graph cannot be saved
      • save

        public void save​(Graph<V,​E> g,
                         java.lang.String filename,
                         com.google.common.base.Function<V,​java.lang.String> vs,
                         com.google.common.base.Function<E,​java.lang.Number> nev)
                  throws java.io.IOException
        Saves the graph to the specified file.
        Parameters:
        g - the graph to be saved
        filename - the filename of the file to write the graph to
        vs - mapping from vertices to labels
        nev - mapping from edges to weights
        Throws:
        java.io.IOException - if the graph cannot be saved
      • save

        public void save​(Graph<V,​E> g,
                         java.lang.String filename)
                  throws java.io.IOException
        Saves the graph to the specified file. No vertex labels are written, and the edge weights are written as 1.0.
        Parameters:
        g - the graph to be saved
        filename - the filename of the file to write the graph to
        Throws:
        java.io.IOException - if the graph cannot be saved
      • save

        public void save​(Graph<V,​E> g,
                         java.io.Writer w)
                  throws java.io.IOException
        Saves the graph to the specified writer. No vertex labels are written, and the edge weights are written as 1.0.
        Parameters:
        g - the graph to be saved
        w - the writer instance to write the graph to
        Throws:
        java.io.IOException - if the graph cannot be saved
      • save

        public void save​(Graph<V,​E> g,
                         java.io.Writer w,
                         com.google.common.base.Function<V,​java.lang.String> vs,
                         com.google.common.base.Function<E,​java.lang.Number> nev)
                  throws java.io.IOException
        Saves the graph to the specified writer.
        Parameters:
        g - the graph to be saved
        w - the writer instance to write the graph to
        vs - mapping from vertices to labels
        nev - mapping from edges to weights
        Throws:
        java.io.IOException - if the graph cannot be saved
      • save

        public void save​(Graph<V,​E> graph,
                         java.io.Writer w,
                         com.google.common.base.Function<V,​java.lang.String> vs,
                         com.google.common.base.Function<E,​java.lang.Number> nev,
                         com.google.common.base.Function<V,​java.awt.geom.Point2D> vld)
                  throws java.io.IOException
        Saves the graph to the specified writer.
        Parameters:
        graph - the graph to be saved
        w - the writer instance to write the graph to
        vs - mapping from vertices to labels (no labels are written if null)
        nev - mapping from edges to weights (defaults to weights of 1.0 if null)
        vld - mapping from vertices to locations (no locations are written if null)
        Throws:
        java.io.IOException - if the graph cannot be saved