We first declare a GraphG. The class Graph does not store any attributes, such as width and heights of nodes; this information is maintained by GraphAttributes. Therefore, we generate an instance GA of GraphAttributes associated to GraphG. The constructor of GraphAttributes allows to select which attributes shall be stored. As we just want to set the width and height of the nodes, we only include nodeGraphics.
GA.readGML(G, “input.gml”) reads a graph from file “input.gml” and stores the graph structure in GraphG while the object of class GraphAttributesGA saves any attribute information the file offers and the GraphAttributes can save. In our example, information to edge colors could not be saved in GA. If the input file does not include information to any attribute GA can store, it will be set to a default value.
forall_nodes(v, G) runs over all nodes in G and addresses them via variable v. A corresponding macro for all edges is available.
GA.width(v) = GA.height(v) = 10.0 sets the width and height of node v to 10.0.
GA.writeGML(“output.gml”) writes all information saved in G and GA to file “output.gml”.
tech/howto/widandhei.txt · Last modified: 2014/12/16 12:20 (external edit)