Traverse the nodes of a diagram


Author
Message
Tim Nelson
Tim Nelson
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)
Group: Forum Members
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?


Ivo Milanov
Ivo Milanov
Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)
Group: Forum Members
Posts: 35, Visits: 32
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


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