microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.34k stars 301 forks source link

using Generics with Node data #341

Open Cairn23 opened 1 year ago

Cairn23 commented 1 year ago

Currently Node derived from GeometryObject has a attribute called user data which can be used to place data associated to the node, so that you can reference the data directed from the node rather than doing a further look in a data set. This is of type object. Would it be better to use generics and have UserData of type . This would then remove the processing to cast to and from object within the code.

levnach commented 1 year ago

I think it is a good idea. Please create the pull request.

Another related issue is that MSAGL creates many 'parallel' graphs. GeometryGraph, DrawingGraph, DGraph, etc. They have the same structure but by the design fault they are replicated. A better solution would be to create one graph class, one node class, and one edge class, and make all the rest graphs, nodes, and edges, attributes on top of those. Then GeometryNode.UserData becomes just another attribute. It seems quite a chunk of work though.

Cairn23 commented 1 year ago

I have started with just a local branch for the moment. There will be 2 generic data types to cover Nodes and linkages. I have taken an approach of unloading all the projects except AutomaticGraphLayout, get that building and working then enable the relevant test projects and build up from there with AutomaticGraphLaout.Graph the following project to convert. Once I get the first project modified and working I will upload the branch