Package moss

Class GraphReader

All Implemented Interfaces:
Closeable, Serializable, AutoCloseable, Readable
Direct Known Subclasses:
LineReader, NEListReader, SDfileReader

public abstract class GraphReader extends TableReader implements Serializable
Class for a reader for graph data sets.
Since:
2007.02.24
See Also:
  • Field Details

    • GRAPHS

      public static final int GRAPHS
      read mode: graphs
      See Also:
    • SUBS

      public static final int SUBS
      read mode: substructures
      See Also:
    • DIRECTED

      public static final int DIRECTED
      read mode: whether graphs/substructures are directed
      See Also:
    • FMTMASK

      public static final int FMTMASK
      read mode mask: table input formats
      See Also:
    • mode

      protected int mode
      the read mode
    • ntn

      protected Notation ntn
      the notation for parsing graph descriptions
    • name

      protected String name
      the name/identifier of the current graph
    • desc

      protected String desc
      the description of the current graph
    • graph

      protected Graph graph
      the current graph
    • value

      protected float value
      the value associated with the current graph
    • nodes

      protected int nodes
      the number of nodes of the current graph
    • edges

      protected int edges
      the number of edges of the current graph
    • sabs

      protected int sabs
      the absolute support in the focus
    • srel

      protected float srel
      the relative support in the focus
    • cabs

      protected int cabs
      the absolute support in the complement
    • crel

      protected float crel
      the relative support in the complement
  • Constructor Details

    • GraphReader

      public GraphReader(Reader reader, int mode)
      Create a reader for a graph data set.
      Parameters:
      reader - the reader to read from
      mode - the read mode
      Since:
      2007.06.29 (Christian Borgelt)
  • Method Details

    • getMode

      public int getMode()
      Get the mode of the graph reader.
      Returns:
      the mode of the graph reader
      Since:
      2007.03.04 (Christian Borgelt)
    • getNotation

      public Notation getNotation()
      Get the notation of the graph reader.
      Returns:
      the notation of the graph reader
      Since:
      2007.03.04 (Christian Borgelt)
    • readHeader

      public abstract boolean readHeader() throws IOException
      Read an (optional) header.
      Returns:
      whether a header was present (otherwise the end of the input has been reached)
      Throws:
      IOException - if an i/o error occurs
      Since:
      2007.03.04 (Christian Borgelt)
    • readGraph

      public abstract boolean readGraph() throws IOException
      Read a graph.

      The next graph description is read and split into the graph name/identifier, the graph description, the associated value (only in mode GRAPHS), and the support information (only in mode SUBS).

      These properties may then be retrieved with the functions getName(), getDesc(), getValue() etc.
      Returns:
      whether another graph description could be read (otherwise the end of the input has been reached)
      Throws:
      IOException - if an i/o error or a parse error occurs
      Since:
      2007.02.24 (Christian Borgelt)
    • getName

      public String getName()
      Get the name of the current graph.
      Returns:
      the name of the current graph
      Since:
      2007.02.24 (Christian Borgelt)
    • getDesc

      public String getDesc()
      Get a line description of the current graph.
      Returns:
      a line description of the current graph
      Since:
      2007.03.04 (Christian Borgelt)
    • getGraph

      public Graph getGraph() throws IOException
      Get the current graph or substructure.
      Returns:
      the current graph
      Throws:
      IOException - if a parse error occurs
      Since:
      2007.03.04 (Christian Borgelt)
    • getNodeCount

      public int getNodeCount()
      Get the number of nodes of the current graph.
      Returns:
      the number of nodes of the current graph or -1 if this number is not known
      Since:
      2007.03.04 (Christian Borgelt)
    • getEdgeCount

      public int getEdgeCount()
      Get the number of edges of the current graph.
      Returns:
      the number of edges of the current graph or -1 if this number is not known
      Since:
      2007.03.04 (Christian Borgelt)
    • getValue

      public float getValue()
      Get the value associated with the current graph.
      Returns:
      the value associated with the current graph
      Since:
      2007.02.24 (Christian Borgelt)
    • getAbsSupp

      public int getAbsSupp()
      Get the absolute focus support of the current substructure.
      Returns:
      the absolute focus support
      Since:
      2007.03.04 (Christian Borgelt)
    • getRelSupp

      public float getRelSupp()
      Get the relative focus support of the current substructure.
      Returns:
      the relative focus support
      Since:
      2007.03.04 (Christian Borgelt)
    • getAbsCompl

      public int getAbsCompl()
      Get the absolute complement support of the current substructure.
      Returns:
      the absolute complement support
      Since:
      2007.03.04 (Christian Borgelt)
    • getRelCompl

      public float getRelCompl()
      Get the relative support of the current substructure.
      Returns:
      the relative complement support
      Since:
      2007.03.04 (Christian Borgelt)
    • createReader

      public static GraphReader createReader(Reader reader, int mode, String format, Notation ntn)
      Create a graph reader for a given format and mode.
      Parameters:
      reader - the reader to read from
      mode - the read mode
      format - the name of the format/notation
      ntn - the notation (if shared with another reader)
      Returns:
      the created graph reader
      Since:
      2021.10.17 (Christian Borgelt)
    • createReader

      public static GraphReader createReader(Reader reader, int mode, String format)
      Create a graph reader for a given format and mode.
      Parameters:
      reader - the reader to read from
      mode - the read mode
      format - the name of the format/notation
      Returns:
      the created graph reader
      Since:
      2007.03.04 (Christian Borgelt)