Graph_GUI - NoaAizer/Graphs GitHub Wiki

This class is a graphical user interface of a graph based on stdDraw.

graph - holds the graph.

Graph_GUI function:

  • Constructor: init, add a graph to draw (_g represents the graph for the drawing).
  • initSize - Initialize the size of the frame according to the x,y ranges.
  • drawGraph - Drawing the graph in the frame.
  • update - Open a new frame with the updated graph.(and close the previous frame).
  • drawNode - Draws a given node on the frame (gr represents the given graph, n represents the node for drawing).
  • drawEdge - Draws a given edge on the frame (gr represents the given graph, e represents the edge for drawing).
  • rangeX and rangeY - Creates a range of the x/y values of the nodes, nodes represents a list with all the nodes in the graph. return the x/y range.

main: This class test is done in the main method, displaying in a GUI window using stdDraw class.