Package moss

Class NamedGraph

java.lang.Object
moss.Graph
moss.NamedGraph
All Implemented Interfaces:
Serializable, Cloneable

public class NamedGraph extends Graph implements Cloneable, Serializable
Class for attributed graphs with a name and a group.

Named graphs also have a name and a group by which they can be classified as being in the focus or in the complement for the search. In addition, they possess a successor pointer, so that they can be connected into a singly linked list. Named graphs are used for storing the graph database to mine.

Since:
2002.03.11/2006.10.23
See Also:
  • Field Details

    • FOCUS

      public static final int FOCUS
      group identifier: focus
      See Also:
    • COMPL

      public static final int COMPL
      group identifier: complement
      See Also:
    • succ

      protected NamedGraph succ
      the next graph in a list
    • name

      protected String name
      the graph name/identifier
    • value

      protected float value
      the value associated with the graph
    • group

      protected int group
      the marker for grouping (either 0 or 1, used as an array index)
  • Constructor Details

    • NamedGraph

      public NamedGraph(Notation ntn)
      Create a graph with an empty name and value and group 0.
      Parameters:
      ntn - the notation of the graph
      Since:
      2006.10.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, String name)
      Create a graph with value and group 0.
      Parameters:
      ntn - the notation of the graph
      name - the name of the graph
      Since:
      2007.02.15 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, String name, boolean dir)
      Create a graph with value and group 0.
      Parameters:
      ntn - the notation of the graph
      name - the name of the graph
      dir - whether the graph is directed
      Since:
      2022.09.27 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, String name, float value, int group)
      Create a graph of default size with a given name and group.
      Parameters:
      ntn - the notation of the graph
      name - the name/identifier of the graph
      value - the associated value
      group - the group of the graph
      Since:
      2006.10.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, String name, float value, int group, boolean dir)
      Create a graph of default size with a given name and group.
      Parameters:
      ntn - the notation of the graph
      name - the name/identifier of the graph
      value - the associated value
      group - the group of the graph
      dir - whether the graph is directed
      Since:
      2006.10.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, int nodecnt, int edgecnt, String name, float value, int group)
      Create a graph with a given name, group and size.
      Parameters:
      ntn - the notation of the graph
      nodecnt - the expected number of nodes
      edgecnt - the expected number of edges
      name - the name/identifier of the graph
      value - the associated value
      group - the group of the graph
      Since:
      2006.10.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Notation ntn, int nodecnt, int edgecnt, String name, float value, int group, boolean dir)
      Create a graph with a given name, group and size.
      Parameters:
      ntn - the notation of the graph
      nodecnt - the expected number of nodes
      edgecnt - the expected number of edges
      name - the name/identifier of the graph
      value - the associated value
      group - the group of the graph
      dir - whether the graph is directed
      Since:
      2022.09.27 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Graph graph)
      Turn a graph into a named graph.

      Note that the constituents of the graph are not copied, so changes to the given graph affect the created named graph.

      Parameters:
      graph - the graph to turn into a named graph
      Since:
      2007.06.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Graph graph, String name)
      Turn a graph into a named graph.

      Note that the constituents of the graph are not copied, so changes to the given graph affect the created named graph.

      Parameters:
      graph - the graph to turn into a named graph
      name - the identifier/name of the graph
      Since:
      2007.06.23 (Christian Borgelt)
    • NamedGraph

      public NamedGraph(Graph graph, String name, float value, int group)
      Turn a graph into a named graph.

      Note that the constituents of the graph are not copied, so changes to the given graph affect the created named graph.

      Parameters:
      graph - the graph to turn into a named graph
      name - the name/identifier of the graph
      value - the associated value
      group - the group of the graph
      Since:
      2007.06.23 (Christian Borgelt)
    • NamedGraph

      protected NamedGraph(NamedGraph graph)
      Clone a named graph.

      This function returns a deep copy of a named graph (all constituents of the named graph are copied). It is intended mainly for debugging purposes.

      Parameters:
      graph - the named graph to duplicate
      Since:
      2006.10.23 (Christian Borgelt)
  • Method Details

    • clone

      public Object clone()
      Create a clone of this named graph.

      This function simply returns new NamedGraph(this). It is intended mainly for debugging purposes.

      Overrides:
      clone in class Graph
      Returns:
      a clone of this named graph
      Since:
      2006.10.23 (Christian Borgelt)
      See Also:
    • setName

      public void setName(String name)
      Set the name of this graph.
      Parameters:
      name - the name to set
      Since:
      2006.10.23 (Christian Borgelt)
    • getName

      public String getName()
      Get the name of this graph.
      Returns:
      the name of this graph
      Since:
      2006.10.23 (Christian Borgelt)
    • setValue

      public void setValue(float value)
      Set the value of this graph.
      Parameters:
      value - the value to set
      Since:
      2007.02.15 (Christian Borgelt)
    • getValue

      public float getValue()
      Get the value of this graph.
      Returns:
      the value of this graph
      Since:
      2007.02.15 (Christian Borgelt)
    • setGroup

      public void setGroup(int group)
      Set the group of this graph.
      Parameters:
      group - the group to set
      Since:
      2006.10.23 (Christian Borgelt)
    • getGroup

      public int getGroup()
      Get the group of this graph.
      Returns:
      the group of this graph
      Since:
      2006.10.23 (Christian Borgelt)
    • split

      public NamedGraph split()
      Split a graph into its connected components.
      Returns:
      a list of graphs representing the connected components or the graph itself if there is only one component
      Since:
      2007.06.14 (Christian Borgelt)
    • toLogic

      public String toLogic()
      Create a Prolog description of this graph.

      The graph is described by a set of predicates, one per node and one per edge, which list the graph they belong to together with their indices and types.

      Returns:
      a Prolog description of this graph
      Since:
      2003.03.31 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for testing some basic functionality.
      Parameters:
      args - the command line arguments
      Since:
      2006.01.02 (Christian Borgelt)