NLayeredGraphLayout and Top-Level Nodes


Author
Message
Patrick Bergeron
Patrick Bergeron
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1

I am using the NLayeredGraphLayout to create a graph from a dataset.  The diagram can have multiple top-level nodes (nodes with no parent).  When dealing with multiple top-level nodes, I noticed that the algorithm places these shapes in various locations within the document.  To remedy this, I created a "dummy" root node and parented all top-level nodes to this new dummy node.  Now the graph draws all top-level nodes correctly.  The problem is, I do not want the dummy node (and the edges from the dummy node to the top-level nodes) to display.  I set the Visible = false property of the root node and edges.  While these nodes are hidden as expected, there is now a blank white space above the top-level nodes.

How would I go about getting the top level nodes to draw as they do now, but without white space left by hiding the dummy node and its edges?

Any help would be greatly appreciated.

 

Thanks.


Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Patrick,

You want to plot a disconnected graph (e.g. a graphs forest) with a layout method that is intended to arrange only connected graphs. All Nevron graph layouts are splitting the input graph to connected regions, that are fed to the primary layout algorithm - in your case a layered graph layout. The regions that were arranged are finally subject to flow layout arrangement - check out this topic in the docs:

Diagram for .NET > User's Guide > Layouts > Graph Parts Layouts > Graph Parts Layouts

So in order to avoid the the final flow layout arrangement step, you need to somehow make the forest of graphs a connected graph prior to layout. This will involve inserting a dummy root vertex and connections to the unparented vertices. Once the layout is performed (after graphImporter.Import() is called), you need to remove these vertices and links.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search