Algorithmic Solutions > LEDA > LEDA Guide > GraphWin > Programming Interface > Attribute and Parameter Operations > Example

Example GraphWin Attribute and Parameter Operations

The following simple program shows how to use the GraphWin attribute and parameter operations.

On the right there is a screenshot of the program. Clicking on the picture shows the window in original size.

GraphWin Attribute and Parameter Operations
#include <LEDA/graphics/graphwin.h>

using namespace leda;

int main()
{
  GraphWin gw;

  //individual node attributes
  node u=gw.new_node(point(100,100));
  gw.set_shape(u,circle_node);
  node v=gw.new_node(point(200,200));
  gw.set_shape(v,rhombus_node);

  //individual edge attributes
  edge e=gw.new_edge(u,v);
  gw.set_width(e,2); 
  gw.set_color(e,brown);
		
  //default node attributes
  bool apply=false;
  gw.set_node_shape(rectangle_node,apply);
  gw.set_node_color(pink,apply);
		
  //default edge attributes
  gw.set_edge_width(5,apply);
  gw.set_edge_color(green,apply);
  gw.set_edge_direction(redirected_edge,apply);

  //global parameters
  gw.set_bg_color(yellow);

  gw.display();
  gw.edit();

  gw.get_window().screenshot("gw_param_ops");

  return 0;
}   

See also:

GraphWin

Programming Interface

Attribute and Parameter Operations

Edit and Run: A Simple Recipe for Interactive Demos with GraphWin

A Recipe for Online Demos of Graph Algorithms

A Recipe for Online Demos of Network Algorithms


Manual Pages:

Manual Page Windows




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH