GraphNode.FindRelatedNodes Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Finds the dgml nodes that matches the acceptNode predicate and are related in a way that matches the traverseLink and traverseNode predicates.
They are found by doing a breadth first search along links matching the traverseLink predicate, in the Source or Target direction designated by the searchDirection parameter. Then if the node matches the traverseNode predicate it keeps searching recurrsively through that node in the same direction and returns all nodes that match the acceptNode predicate. The search can handle circularity in the graph.
Namespace: Microsoft.VisualStudio.GraphModel
Assembly: Microsoft.VisualStudio.GraphModel (in Microsoft.VisualStudio.GraphModel.dll)
Syntax
'Declaration
Public Function FindRelatedNodes ( _
searchDirection As GraphSearchDirection, _
traverseLink As Predicate(Of GraphLink), _
traverseNode As Predicate(Of GraphNode), _
acceptNode As Predicate(Of GraphNode) _
) As IEnumerable(Of GraphNode)
public IEnumerable<GraphNode> FindRelatedNodes(
GraphSearchDirection searchDirection,
Predicate<GraphLink> traverseLink,
Predicate<GraphNode> traverseNode,
Predicate<GraphNode> acceptNode
)
public:
IEnumerable<GraphNode^>^ FindRelatedNodes(
GraphSearchDirection searchDirection,
Predicate<GraphLink^>^ traverseLink,
Predicate<GraphNode^>^ traverseNode,
Predicate<GraphNode^>^ acceptNode
)
member FindRelatedNodes :
searchDirection:GraphSearchDirection *
traverseLink:Predicate<GraphLink> *
traverseNode:Predicate<GraphNode> *
acceptNode:Predicate<GraphNode> -> IEnumerable<GraphNode>
public function FindRelatedNodes(
searchDirection : GraphSearchDirection,
traverseLink : Predicate<GraphLink>,
traverseNode : Predicate<GraphNode>,
acceptNode : Predicate<GraphNode>
) : IEnumerable<GraphNode>
Parameters
searchDirection
Type: Microsoft.VisualStudio.GraphModel.GraphSearchDirectionPass Source to search nodes that link to this node.
traverseLink
Type: System.Predicate<GraphLink>A predicate function to control link traversal behavior, pass null if you want to traverse all links
traverseNode
Type: System.Predicate<GraphNode>A predicate to control node traversal behavior, pass null if you want to traverse all reachable nodes
acceptNode
Type: System.Predicate<GraphNode>A predicate to control if a node is to be included in the search or not, pass null if you want to accept all nodes
Return Value
Type: System.Collections.Generic.IEnumerable<GraphNode>
An iterator over the related nodes that were found returned in depth first order, an empty iterator otherwise
Remarks
The following example searches through all nodes reachable via all links from the start node and returns all nodes that have the Method category: start.FindRelatedNodes(GraphSearchDirection.Target, l => true, n => true, n => HasCategory(MethodCategory);
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.