INTERFACE GDHeurCreator; (* Creator heuristics for layered drawings *) IMPORT Random; IMPORT GDGraph AS Graph; IMPORT GDLayeredDrawing AS LDwg; FROM GDGeometry IMPORT LONG, NAT; (* These heuristic procedures ignore the input drawing "dr" and (usually) return a new drawing generated from scratch. Most of them also ignore the "inertia" and "count" arguments. *) PROCEDURE FastRandom( G: Graph.T; <*UNUSED*> dr: LDwg.T; rnd: Random.T; <*UNUSED*> inertia: LONG; <*UNUSED*> count: NAT; <*UNUSED*> name: TEXT; ): LDwg.T; (* Generates a "random" drawing for teh graph by placing each vertex o a separate layer, then adding edges always outside the current edges. *) PROCEDURE NewRandom( G: Graph.T; <*UNUSED*> dr: LDwg.T; rnd: Random.T; <*UNUSED*> inertia: LONG; <*UNUSED*> count: NAT; <*UNUSED*> name: TEXT; ): LDwg.T; (* Creates a new drawing by placing each node on a distinct level, then inserting edges through the middle. *) PROCEDURE SmartRandom( G: Graph.T; <*UNUSED*> dr: LDwg.T; rnd: Random.T; inertia: LONG; count: NAT; <*UNUSED*> name: TEXT; ): LDwg.T; (* Composite heuristic: creates a random drawing with "NewRandom", them applies a few rounds fo "AdjustY...", then "FixEDirs", then "AdjustXDown" and "AdjustXUp". *) PROCEDURE WiseRandom( G: Graph.T; <*UNUSED*> dr: LDwg.T; rnd: Random.T; <*UNUSED*> inertia: LONG; <*UNUSED*> count: NAT; <*UNUSED*> name: TEXT; ): LDwg.T; (* Uses "HTools.ChooseYCoords" and "HTools.ChooseXCoords" to pick the new node coordinates, then "HTools.WiseAddPolyline" to insert the polylines. *) PROCEDURE ReadFile( G: Graph.T; <*UNUSED*> dr: LDwg.T; <*UNUSED*> rnd: Random.T; <*UNUSED*> inertia: LONG; <*UNUSED*> count: NAT; name: TEXT; ): LDwg.T; (* A `cheating' heuristics - reads a new drawing from file "name", whose base graph must be isomorphic to "dr.G". *) END GDHeurCreator. (* Last edited on 2000-01-12 18:27:35 by stolfi *)