Class AigGraphPlotter<G extends Graph<N>, N extends Node>

java.lang.Object
org.tweetyproject.graphs.util.AigGraphPlotter<G,N>
Direct Known Subclasses:
AigSerialisationPlotter

public class AigGraphPlotter<G extends Graph<N>, N extends Node> extends Object
Implements methods for displaying graphs via the aig-graph-component
Author:
Lars Bengel
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes a new instance of the graph plotter for the given graph
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    convert(String input)
    Utility method that converts a String into a LaTeX-math string
    getColor(N node)
    Returns the color associated with the specified node.
    getColor(GeneralEdge<? extends N> link)
    Returns the color associated with the specified edge in the graph.
    boolean
    isDeletable(N node)
    Determines whether the specified node is deletable.
    boolean
    isDeletable(GeneralEdge<? extends N> link)
    Determines whether the specified edge can be deleted from the graph.
    boolean
    Determines whether the label of the specified node is editable.
    boolean
    isLabelEditable(GeneralEdge<? extends N> link)
    Determines whether the label of the specified edge is editable.
    boolean
    Checks whether the specified node has a fixed X position.
    boolean
    Checks whether the Y position of the specified node is fixed.
    void
    makeLeveled(N root)
    ensures that the graph nodes are positioned in levels depending on their distance to the given root node
    void
    setColor(N node, String color)
    Sets the color of the specified node in the graph.
    void
    setColor(GeneralEdge<? extends N> link, String color)
    Sets the color of the specified edge in the graph.
    void
    setDeletable(N node, boolean nodeDeletable)
    Sets whether the specified node is deletable.
    void
    setDeletable(GeneralEdge<? extends N> link, boolean linkDeletable)
    Sets whether the specified link (edge) in the graph is deletable.
    void
    setEnableLatex(boolean enableLatex)
    Aktiviert oder deaktiviert die Verwendung von LaTeX zur Darstellung von Formeln oder Text.
    void
    setLabelEditable(N node, boolean labelEditable)
    Sets whether the label of the specified node is editable.
    void
    setLabelEditable(GeneralEdge<? extends N> link, boolean labelEditable)
    Sets whether the label of the specified edge is editable.
    void
    Sets the color of all links in the graph to the specified color.
    void
    setLinkDeletable(boolean linkDeletable)
    Sets the deletable status for all links in the graph.
    void
    setLinkLabelEditable(boolean labelEditable)
    Sets the editability of the labels for all links in the graph.
    void
    Sets the color of all nodes in the graph to the specified color.
    void
    setNodeDeletable(boolean nodeDeletable)
    Sets the deletable status for all nodes in the graph.
    void
    setNodeFixedPositionX(boolean fixedPositionX)
    Sets whether the X position of all nodes in the graph should be fixed.
    void
    setNodeFixedPositionX(N node, boolean fixedPositionX)
    Sets whether the X position of the specified node should be fixed.
    void
    setNodeFixedPositionY(boolean fixedPositionY)
    Sets whether the Y position of all nodes in the graph should be fixed.
    void
    setNodeFixedPositionY(N node, boolean fixedPositionY)
    Sets whether the Y position of the specified node should be fixed.
    void
    setNodeLabelEditable(boolean labelEditable)
    Sets whether the labels of all nodes in the graph are editable.
    void
    setNodePositionX(N node, int positionX)
    Sets the X-coordinate position for the specified node in the graph.
    void
    setNodePositionY(N node, int positionY)
    Sets the Y-coordinate position for the specified node in the graph.
    void
    setToggleFixedLinkDistance(boolean toggleFixedLinkDistance)
    Aktiviert oder deaktiviert eine feste Kantenlänge im Graphenlayout.
    void
    setToggleGraphEditingInGUI(boolean toggleGraphEditingInGUI)
    Aktiviert oder deaktiviert die Möglichkeit zur Bearbeitung des Graphen über die Benutzeroberfläche.
    void
    setToggleLinkLabels(boolean toggleLinkLabels)
    Aktiviert oder deaktiviert die Anzeige von Kantentexten im Graphen.
    void
    setToggleNodeLabels(boolean toggleNodeLabels)
    Aktiviert oder deaktiviert die Anzeige von Knotentexten im Graphen.
    void
    setToggleNodePhysics(boolean toggleNodePhysics)
    Aktiviert oder deaktiviert die Physiksimulation für Knoten im Graphen.
    void
    setToggleZoom(boolean toggleZoom)
    Aktiviert oder deaktiviert die Zoom-Funktionalität im Graph.
    void
    Renders the graph in the web browser via the aig-graph-component
    static void
    show(Graph<? extends Node> graph)
    Renders the given graph in the web browser via the aig-graph-component
    Creates a JSON-String for the graph in the aig-graph format
    static String
    write(Graph<? extends Node> graph)
    Creates a JSON-String for the given graph in the aig-graph format

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AigGraphPlotter

      public AigGraphPlotter(G graph)
      Initializes a new instance of the graph plotter for the given graph
      Parameters:
      graph - some graph
  • Method Details

    • write

      public static String write(Graph<? extends Node> graph)
      Creates a JSON-String for the given graph in the aig-graph format
      Parameters:
      graph - some graph
      Returns:
      JSON-String representation of the given graph
    • write

      public String write()
      Creates a JSON-String for the graph in the aig-graph format
      Returns:
      JSON-String representation of the graph
    • makeLeveled

      public void makeLeveled(N root)
      ensures that the graph nodes are positioned in levels depending on their distance to the given root node
      Parameters:
      root - origin node
    • show

      public static void show(Graph<? extends Node> graph)
      Renders the given graph in the web browser via the aig-graph-component
      Parameters:
      graph - some graph
    • show

      public void show()
      Renders the graph in the web browser via the aig-graph-component
    • convert

      public static String convert(String input)
      Utility method that converts a String into a LaTeX-math string
      Parameters:
      input - some string containing LaTeX math-code
      Returns:
      the converted string
    • setEnableLatex

      public void setEnableLatex(boolean enableLatex)
      Aktiviert oder deaktiviert die Verwendung von LaTeX zur Darstellung von Formeln oder Text.
      Parameters:
      enableLatex - true, um LaTeX-Darstellung zu aktivieren; false, um sie zu deaktivieren.
    • setToggleZoom

      public void setToggleZoom(boolean toggleZoom)
      Aktiviert oder deaktiviert die Zoom-Funktionalität im Graph.
      Parameters:
      toggleZoom - true, um Zoom zu aktivieren; false, um Zoom zu deaktivieren.
    • setToggleNodePhysics

      public void setToggleNodePhysics(boolean toggleNodePhysics)
      Aktiviert oder deaktiviert die Physiksimulation für Knoten im Graphen.
      Parameters:
      toggleNodePhysics - true, um Physiksimulation zu aktivieren; false, um sie zu deaktivieren.
    • setToggleFixedLinkDistance

      public void setToggleFixedLinkDistance(boolean toggleFixedLinkDistance)
      Aktiviert oder deaktiviert eine feste Kantenlänge im Graphenlayout.
      Parameters:
      toggleFixedLinkDistance - true, um eine feste Kantenlänge zu verwenden; false, um sie dynamisch zu lassen.
    • setToggleGraphEditingInGUI

      public void setToggleGraphEditingInGUI(boolean toggleGraphEditingInGUI)
      Aktiviert oder deaktiviert die Möglichkeit zur Bearbeitung des Graphen über die Benutzeroberfläche.
      Parameters:
      toggleGraphEditingInGUI - true, um die Bearbeitung im GUI zu erlauben; false, um sie zu deaktivieren.
    • setToggleNodeLabels

      public void setToggleNodeLabels(boolean toggleNodeLabels)
      Aktiviert oder deaktiviert die Anzeige von Knotentexten im Graphen.
      Parameters:
      toggleNodeLabels - true, um Knotentexte anzuzeigen; false, um sie auszublenden.
    • setToggleLinkLabels

      public void setToggleLinkLabels(boolean toggleLinkLabels)
      Aktiviert oder deaktiviert die Anzeige von Kantentexten im Graphen.
      Parameters:
      toggleLinkLabels - true, um Kantentexte anzuzeigen; false, um sie auszublenden.
    • setDeletable

      public void setDeletable(N node, boolean nodeDeletable)
      Sets whether the specified node is deletable.
      Parameters:
      node - the node whose deletable status is to be set
      nodeDeletable - true if the node should be deletable; false otherwise
    • setNodeDeletable

      public void setNodeDeletable(boolean nodeDeletable)
      Sets the deletable status for all nodes in the graph.

      This method iterates over all nodes and updates their deletable property according to the specified value.

      Parameters:
      nodeDeletable - true if nodes should be deletable; false otherwise
    • isDeletable

      public boolean isDeletable(N node)
      Determines whether the specified node is deletable.
      Parameters:
      node - the node to check for deletability
      Returns:
      true if the node is deletable; false otherwise
    • setLabelEditable

      public void setLabelEditable(N node, boolean labelEditable)
      Sets whether the label of the specified node is editable.
      Parameters:
      node - the node whose label editability is to be set
      labelEditable - true if the label should be editable; false otherwise
    • setNodeLabelEditable

      public void setNodeLabelEditable(boolean labelEditable)
      Sets whether the labels of all nodes in the graph are editable.
      Parameters:
      labelEditable - true if node labels should be editable; false otherwise.
    • isLabelEditable

      public boolean isLabelEditable(N node)
      Determines whether the label of the specified node is editable.
      Parameters:
      node - the node whose label editability is to be checked
      Returns:
      true if the label of the node is editable; false otherwise
    • setNodeFixedPositionX

      public void setNodeFixedPositionX(N node, boolean fixedPositionX)
      Sets whether the X position of the specified node should be fixed.
      Parameters:
      node - the node whose X position fixed state is to be set
      fixedPositionX - true to fix the X position of the node, false to allow it to move
    • setNodeFixedPositionX

      public void setNodeFixedPositionX(boolean fixedPositionX)
      Sets whether the X position of all nodes in the graph should be fixed.
      Parameters:
      fixedPositionX - true to fix the X position of all nodes, false to allow movement.
    • isNodeFixedPositionX

      public boolean isNodeFixedPositionX(N node)
      Checks whether the specified node has a fixed X position.
      Parameters:
      node - the node to check
      Returns:
      true if the node has a fixed X position; false otherwise
    • setNodeFixedPositionY

      public void setNodeFixedPositionY(N node, boolean fixedPositionY)
      Sets whether the Y position of the specified node should be fixed.
      Parameters:
      node - the node whose Y position fixed status is to be set
      fixedPositionY - true to fix the Y position of the node, false to allow it to move
    • setNodeFixedPositionY

      public void setNodeFixedPositionY(boolean fixedPositionY)
      Sets whether the Y position of all nodes in the graph should be fixed.
      Parameters:
      fixedPositionY - true to fix the Y position of all nodes, false to allow movement.
    • isNodeFixedPositionY

      public boolean isNodeFixedPositionY(N node)
      Checks whether the Y position of the specified node is fixed.
      Parameters:
      node - the node to check
      Returns:
      true if the Y position of the node is fixed; false otherwise
    • setNodePositionX

      public void setNodePositionX(N node, int positionX)
      Sets the X-coordinate position for the specified node in the graph.
      Parameters:
      node - the node whose X position is to be set
      positionX - the X-coordinate value to assign to the node
    • setNodePositionY

      public void setNodePositionY(N node, int positionY)
      Sets the Y-coordinate position for the specified node in the graph.
      Parameters:
      node - the node whose Y position is to be set
      positionY - the Y-coordinate value to assign to the node
    • setDeletable

      public void setDeletable(GeneralEdge<? extends N> link, boolean linkDeletable)
      Sets whether the specified link (edge) in the graph is deletable.
      Parameters:
      link - the edge whose deletable status is to be set
      linkDeletable - true if the link should be deletable; false otherwise
    • setLinkDeletable

      public void setLinkDeletable(boolean linkDeletable)
      Sets the deletable status for all links in the graph.

      This method iterates over all links and updates their deletable property according to the specified value.

      Parameters:
      linkDeletable - true if the links should be deletable; false otherwise.
    • isDeletable

      public boolean isDeletable(GeneralEdge<? extends N> link)
      Determines whether the specified edge can be deleted from the graph.
      Parameters:
      link - the edge to check for deletability
      Returns:
      true if the edge is deletable; false otherwise
    • setLabelEditable

      public void setLabelEditable(GeneralEdge<? extends N> link, boolean labelEditable)
      Sets whether the label of the specified edge is editable.
      Parameters:
      link - the edge whose label editability is to be set
      labelEditable - true if the label should be editable; false otherwise
    • setLinkLabelEditable

      public void setLinkLabelEditable(boolean labelEditable)
      Sets the editability of the labels for all links in the graph.
      Parameters:
      labelEditable - true if the link labels should be editable; false otherwise.
    • isLabelEditable

      public boolean isLabelEditable(GeneralEdge<? extends N> link)
      Determines whether the label of the specified edge is editable.
      Parameters:
      link - the edge whose label editability is to be checked
      Returns:
      true if the label of the given edge is editable; false otherwise
    • setColor

      public void setColor(GeneralEdge<? extends N> link, String color)
      Sets the color of the specified edge in the graph.
      Parameters:
      link - the edge whose color is to be set
      color - the color to assign to the edge
    • setColor

      public void setColor(N node, String color)
      Sets the color of the specified node in the graph.
      Parameters:
      node - the node whose color is to be set
      color - the color to assign to the node, represented as a string (e.g., "red", "#FF0000")
    • setNodeColor

      public void setNodeColor(String color)
      Sets the color of all nodes in the graph to the specified color.
      Parameters:
      color - the color to set for all nodes
    • setLinkColor

      public void setLinkColor(String color)
      Sets the color of all links in the graph to the specified color.
      Parameters:
      color - the color to set for all links, represented as a string (e.g., a hex color code or color name)
    • getColor

      public String getColor(GeneralEdge<? extends N> link)
      Returns the color associated with the specified edge in the graph.
      Parameters:
      link - the edge whose color is to be retrieved
      Returns:
      the color of the given edge as a String
    • getColor

      public String getColor(N node)
      Returns the color associated with the specified node.
      Parameters:
      node - the node whose color is to be retrieved
      Returns:
      the color of the given node as a String