Inheritance: INotifyPropertyChanged
Exemplo n.º 1
0
 /// <summary>
 /// Returns the nodes that are neighbors of the given node, that is, nodes that are directly connected to the
 /// given node via an edge.
 /// </summary>
 /// <param name="node">The node to find neighbors of.</param>
 /// <returns>An <see cref="IEnumerable{T}"/> of the neighboring nodes.</returns>
 public IEnumerable <ModelNode> GetNeighbors(ModelNode node)
 {
     return(edges.Where(e => e.Source == node).Select(e => e.Target)
            .Union(edges.Where(e => e.Target == node).Select(e => e.Source)));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the edges having the given node as either source or target.
 /// </summary>
 /// <param name="node">The node to find connected edges of.</param>
 /// <returns>An <see cref="IEnumerable{T}"/> of the edges that are connected to the node.</returns>
 public IEnumerable <ModelEdge> GetAdjacentEdges(ModelNode node)
 {
     return(edges.Where(e => e.Source == node || e.Target == node));
 }