Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/eXene/examples/ml-viewer/graphs
ViewVC logotype

Annotation of /sml/trunk/src/eXene/examples/ml-viewer/graphs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download)

1 : monnier 2 Here is a rough sketch of the graph data structures used in the viewer.
2 :     The three levels (three types of "graphs" and "nodes") reflect the
3 :     structure (abstract graph) -> (graph embedded in plane) -> (window on graph).
4 :     Some of the redundancies in the data structures are for efficiency; the
5 :     rest are due to the code not being redesigned since it was written in PML.
6 :    
7 :     The edges and nodes of an attributed graph (ATTR_GRAPH) carry a
8 :     dictionary (name/value pairs) and user-defined info. The dictionaries
9 :     are referenced using getAttr/setAttr. The user-defined info is
10 :     referenced using infoOfNode, infoOfGraph and infoOfEdge.
11 :    
12 :     The .dot file is read in to create a ModGraph.graph, which is an attributed
13 :     graph. The nodes and edges look like:
14 :    
15 :     Node
16 :     [
17 :     name : string,
18 :     dictionary : string dict,
19 :     info : ref to
20 :     {
21 :     center : G.point, (* from "pos" in dict *)
22 :     size : G.size, (* from "width","height" in dict *)
23 :     shape : shape, (* from "shape" in dict *)
24 :     label : string (* from "label" in dict *)
25 :     }
26 :     ]
27 :    
28 :     Edge
29 :     [
30 :     dictionary : string dict,
31 :     info : ref to
32 :     {
33 :     pts : G.point list, (* from "pos" in dict *)
34 :     arrow : G.point (* from "pos" in dict *)
35 :     }
36 :     ]
37 :    
38 :     VGraphAux.mkVGraphOn converts this graph to a VGraph.graph, which is
39 :     also an attributed graph. Its nodes and edges look like:
40 :    
41 :     Node
42 :     [
43 :     name : string, (* same as related ModGraph node *)
44 :     dictionary : string dict, (* empty *)
45 :     info :
46 :     {
47 :     base : ModGraph.node, (* related node in ModGraph *)
48 :     pos : Geometry.point, (* base.center, scaled *)
49 :     shape : Attr.shape, (* base.shape *)
50 :     bbox : Geometry.rect, (* bounding box of base, scaled *)
51 :     label : string (* base.label *)
52 :     }
53 :     ]
54 :    
55 :     Edge
56 :     [
57 :     dictionary : string dict, (* empty *)
58 :     info :
59 :     {
60 :     pts : G.point list, (* pts from related edge, scaled *)
61 :     arrow : G.point list (* pts to draw arrow head *)
62 :     }
63 :     ]
64 :    
65 :     Finally, the actually viewer maintains a set of visible nodes, represented
66 :     as follows. There is no actual graph structure involved.
67 :    
68 :     {
69 :     node : VGraph.node, (* related VGraph node *)
70 :     bbox : rect, (* screen bounding box *)
71 :     draw : (drawable * pen) -> rect -> unit, (* draw function *)
72 :     fill : (drawable * pen) -> rect -> unit, (* fill function *)
73 :     label : string (* node.label *)
74 :     }
75 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0