All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DrawGraph extends JPanel
Class for visualizing a Bayesian Network or a Graph.
See Also:
  • Constructor Details

    • DrawGraph

      public DrawGraph(int[][] Graph)
      Consructor for the class
      Parameters:
      Graph - - Adjacency matrix for the network/graph
  • Method Details

    • main

      public static void main(String[] args)
    • saveImage

      public void saveImage()
      Used for saving the image as a JPEG file.
      Parameters:
      None -
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • getTargetNodes

      public ArrayList<Integer> getTargetNodes(int Node)
      Gets the list of all nodes (children) to which the node Node points.
      Parameters:
      Node - - Node in the Graph
      Returns:
      An ArrayList of integers which are the indices of the target nodes
    • drawCenteredCircle

      public void drawCenteredCircle(Graphics2D g, int x, int y, int r)
      Draws a circle with radius r and center (x,y)
      Parameters:
      g - - Graphics2D object
      x - - x coordinate of circle center
      y - - y coordinate of circle center
      r - - radius of circle