Group: Forum Members
Last Active: 15 Years Ago
Posts: 2,
Visits: 1
|
I am new to this product so maybe someone can give me a hand.
I have a diagram where I need it to display in two different ways:
1. I have a key node, I want to show ONLY my parent nodes and my child nodes. 2. I have a key node, I want to show my parent nodes, my child nodes, and any cousins (child nodes of my parents)
Is there a way to iterate the diagram nodes and selectively show the diagram in one of these two ways?
|
Group: Forum Members
Last Active: 2 Months Ago
Posts: 35,
Visits: 15
|
Hi Tim,
You can use the built in shape navigation features of each shape - read this topic from the help: Diagram for .NET > User's Guide > Document Object Model > Models > Shapes > Shape Navigation
To get the parent nodes use the GetSourceShapes() method. To get the child nodes use the GetDestinationShapes() method.
(Note: the terms parent and child are only applicable to tree graphs - in the case of a generic graph such as the diagram we have used the terms applicable to graphs - source and destinations). If the graph is directed the siblings of a node are all destinations of all source shapes. You can use the AddDistinct method of the node list to build the list of such nodes in (it is quite possible to have duplicates especially if the graph has self loops).
Best regards, Ivo
|