Search Results for

    Show / Hide Table of Contents

    Class Node

    Represents a node with one or more variables in a Bayesian network.

    Inheritance
    System.Object
    Node
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: BayesServer
    Assembly: BayesServer.dll
    Syntax
    public sealed class Node : INotifyPropertyChanged
    Remarks

    Note that node names must be unique per network, and are case sensitive.

    To specify a distribution for a node, see the Distribution property.

    To add a directed link between two nodes, it must be added through the Network.Links property.

    Constructors

    Node()

    Initializes a new instance of the Node class, with no variables, and no name.

    Declaration
    public Node()

    Node(Variable)

    Initializes a new instance of the Node class with a specified Variable and assigns the name of the variable to the node.

    Declaration
    public Node(Variable variable)
    Parameters
    Type Name Description
    Variable variable

    A single variable for the node.

    Node(String, State[])

    Initializes a new instance of the Node class, with the name of the node, automatically creating an associated discrete Variable and adds the states specified in states to that variable.

    Declaration
    public Node(string name, params State[] states)
    Parameters
    Type Name Description
    System.String name

    The name of the node and variable.

    State[] states

    The states to add to the associated Variable.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Raised when states is null.

    Node(String, Variable[])

    Initializes a new instance of the Node class with a specified name and a number of variables.

    Declaration
    public Node(string name, params Variable[] variables)
    Parameters
    Type Name Description
    System.String name

    The name for the node.

    Variable[] variables

    The variable(s) represented by the node.

    Node(String, VariableValueType)

    Initializes a new instance of the Node class with the specified name. A Variable is automatically created for the node and assigned the same name as the node with the VariableValueType specified.

    Declaration
    public Node(string name, VariableValueType valueType)
    Parameters
    Type Name Description
    System.String name

    The name to give the node and variable, which can be null or empty.

    VariableValueType valueType

    The VariableValueType of the node variable, e.g. discrete or continuous.

    Node(String, VariableValueType, VariableKind)

    Initializes a new instance of the Node class with the specified name. A Variable is automatically created for the node and assigned the same name as the node with the VariableValueType specified.

    Declaration
    public Node(string name, VariableValueType valueType, VariableKind kind)
    Parameters
    Type Name Description
    System.String name

    The name to give the node and variable, which can be null or empty.

    VariableValueType valueType

    The VariableValueType of the node variable, e.g. discrete or continuous.

    VariableKind kind

    The kind of variable, e.g. Probability (standard), Decision or Utility.

    Node(String, IList<Variable>)

    Initializes a new instance of the Node class with a specified name and a number of variables.

    Declaration
    public Node(string name, IList<Variable> variables)
    Parameters
    Type Name Description
    System.String name

    The name for the node.

    System.Collections.Generic.IList<Variable> variables

    The variable(s) represented by the node.

    Node(String, Int32)

    Initializes a new instance of the Node class with the specified name and automatically adds a discrete Variable with the number of states specified in states.

    Declaration
    public Node(string name, int states)
    Parameters
    Type Name Description
    System.String name

    The name to give the node and variable, which can be null or empty.

    System.Int32 states

    The number of states to add to the automatically created Variable. States will be given default names.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Raised when the states parameter is less than zero.

    Node(String, String[])

    Initializes a new instance of the Node class, with the name of the node, automatically creating an associated discrete Variable and adds the states specified in states to that variable.

    Declaration
    public Node(string name, string[] states)
    Parameters
    Type Name Description
    System.String name

    The name of the node and variable.

    System.String[] states

    The states to add to the associated Variable, specified by their names.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Raised when states is null.

    Properties

    Bounds

    Gets or sets the size and location of the node.

    Declaration
    public Bounds Bounds { get; set; }
    Property Value
    Type Description
    Bounds

    The size and location of the node.

    CausalObservability

    The CausalObservability of the node. The default value is Observable.

    Declaration
    public CausalObservability CausalObservability { get; set; }
    Property Value
    Type Description
    CausalObservability

    CustomProperties

    Gets custom properties associated with this instance.

    Declaration
    public CustomPropertyCollection CustomProperties { get; }
    Property Value
    Type Description
    CustomPropertyCollection
    Remarks

    Custom properties allow storage of custom information, which will be saved with the network.

    Description

    An optional description for the node.

    Declaration
    public string Description { get; set; }
    Property Value
    Type Description
    System.String

    Distribution

    Returns the distribution currently associated with the Node. The distribution cannot be modified when it is assigned to a node. It is also automatically set to null, when certain structural changes occur (see remarks).

    Declaration
    public IDistribution Distribution { get; set; }
    Property Value
    Type Description
    IDistribution
    Remarks

    If a structural change occurs to the network that invalidates the current distribution, it is automatically set to null. This occurs in the following situations:

    • States are added or removed from the node.
    • States are added or removed from one of the node's parents.
    • The LinksIn collection changes. I.e. adding or removing a parent node. Note that if a node is removed from a network, all of its links are automatically removed also.
    Exceptions
    Type Condition
    System.ArgumentException

    Raised when the distribution is invalid.

    DistributionOptions

    Options that apply to all distributions of this instance.

    Declaration
    public NodeDistributionOptions DistributionOptions { get; }
    Property Value
    Type Description
    NodeDistributionOptions

    Distributions

    Returns the distributions associated with this instance with NodeDistributionKind = Probability. Some node types such as temporal nodes can have more than one distribution assigned to them.

    Declaration
    public NodeDistributions Distributions { get; }
    Property Value
    Type Description
    NodeDistributions

    Groups

    Gets the groups this node belongs to.

    Declaration
    public NodeGroupCollection Groups { get; }
    Property Value
    Type Description
    NodeGroupCollection

    Index

    The Index of this instance in the collection of nodes belonging to a network, or -1 if the node does not belong to a network.

    Declaration
    public int Index { get; }
    Property Value
    Type Description
    System.Int32

    Links

    Collection of both incoming and outgoing links (parent and child nodes).

    Declaration
    public NodeLinkCollection Links { get; }
    Property Value
    Type Description
    NodeLinkCollection

    LinksIn

    Collection of incoming links (linking to parent nodes).

    Declaration
    public NodeLinkCollection LinksIn { get; }
    Property Value
    Type Description
    NodeLinkCollection

    LinksOut

    Collection of outgoing links (linking to child nodes).

    Declaration
    public NodeLinkCollection LinksOut { get; }
    Property Value
    Type Description
    NodeLinkCollection

    Name

    The name of the node. Node names in a network must be unique, and comparisons are case sensitive.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    Network

    The Network the node belongs to. Value will be null unless the node has been added to a network.

    Declaration
    [Browsable(false)]
    public Network Network { get; }
    Property Value
    Type Description
    Network

    TemporalType

    The TemporalType of the node. The default value is Contemporal.

    Declaration
    public TemporalType TemporalType { get; set; }
    Property Value
    Type Description
    TemporalType
    Exceptions
    Type Condition
    System.InvalidOperationException

    Raised if the node belongs to a network, in which case the TemporalType cannot be changed.

    Variables

    Collection of variables represented by the node.

    Declaration
    public NodeVariableCollection Variables { get; }
    Property Value
    Type Description
    NodeVariableCollection

    Methods

    Copy()

    Makes a copy of this instance.

    Declaration
    public Node Copy()
    Returns
    Type Description
    Node

    The copy.

    Remarks

    The copy does not include links or distribution(s).

    NewDistribution()

    Creates a new distribution suitable for the node, however does not assign it to the node's Distribution property.

    Declaration
    public IDistribution NewDistribution()
    Returns
    Type Description
    IDistribution

    A new distribution.

    Remarks

    This method is useful for creating distributions appropriate for a node. However, the returned distribution cannot be set to Distribution until the distribution has been correctly specified.

    Note: if the resulting distribution contains continuous variables, but no discrete head variables, all table values are initialized to 1.

    Exceptions
    Type Condition
    System.ArgumentException

    Raised if the node or one of it's parents has zero states.

    NewDistribution(NodeDistributionKey)

    Creates a new distribution suitable for the requested temporal order/related node, however it is not assigned to the node. Use Distributions to perform the assignment.

    Declaration
    public IDistribution NewDistribution(NodeDistributionKey key)
    Parameters
    Type Name Description
    NodeDistributionKey key

    Identifies the order/related node for the requested distribution.

    Returns
    Type Description
    IDistribution

    The new distribution.

    Remarks

    See NodeDistributions for more information.

    Note: if the resulting distribution contains continuous variables, but no discrete head variables, all table values are initialized to 1.

    A noisy node is specified using multiple distributions, one for each parent and a leak distribution. Set the related node property to a parent, or set it to the current node to set the leak distribution. Each distribution corresponding to a parent of the noisy node has a number of constrained values which are not parameters. These are automatically set by newDistribution (see the help for noisy nodes in the main documentation for more detail).

    See Also
    NodeDistributions

    NewDistribution(NodeDistributionKey, NodeDistributionKind)

    Creates a new distribution suitable for the requested temporal order/related node, however it is not assigned to the node. Use Distributions to perform the assignment.

    Declaration
    public IDistribution NewDistribution(NodeDistributionKey key, NodeDistributionKind kind)
    Parameters
    Type Name Description
    NodeDistributionKey key

    Identifies the order/related node for the requested distribution.

    NodeDistributionKind kind

    The kind of distribution to create.

    Returns
    Type Description
    IDistribution

    The new distribution.

    Remarks

    See NodeDistributions for more information.

    Note: if the resulting distribution contains continuous variables, but no discrete head variables, all table values are initialized to 1.

    Experience table entries are also initialized to 1.

    A noisy node is specified using multiple distributions, one for each parent and a leak distribution. Set the related node property to a parent, or set it to the current node to set the leak distribution. Each distribution corresponding to a parent of the noisy node has a number of constrained values which are not parameters. These are automatically set by newDistribution (see the help for noisy nodes in the main documentation for more detail).

    See Also
    NodeDistributions

    NewDistribution(NodeDistributionKey, NodeDistributionKind, IDistributionExpression)

    Creates a new distribution from an expression suitable for the requested temporal order/related node, however it is not assigned to the node, and neither is the expression. Use BayesServer.Node.Distributions.Expressions to perform the assignment from an expression.

    Declaration
    public IDistribution NewDistribution(NodeDistributionKey key, NodeDistributionKind kind, IDistributionExpression expression)
    Parameters
    Type Name Description
    NodeDistributionKey key
    NodeDistributionKind kind
    IDistributionExpression expression
    Returns
    Type Description
    IDistribution

    The new distribution.

    Remarks

    See Expressions for more information.

    Identifies the order/related node for the requested distribution. The kind of distribution to create. The expression that should be used to generate the distribution.
    See Also
    Expressions

    NewDistribution(NodeDistributionKind)

    Creates a new distribution with the given kind, however it is not assigned to the node. Use Distributions to perform the assignment. For temporal or noisy nodes us a different overload.

    Declaration
    public IDistribution NewDistribution(NodeDistributionKind kind)
    Parameters
    Type Name Description
    NodeDistributionKind kind

    The kind of distribution to create.

    Returns
    Type Description
    IDistribution

    The new distribution.

    Remarks

    See NodeDistributions for more information.

    Note: if the resulting distribution contains continuous variables, but no discrete head variables, all table values are initialized to 1.

    See Also
    NodeDistributions

    NewDistribution(Int32)

    Creates a new distribution suitable for the requested temporal order, however it is not assigned to the node. Use Distributions to perform the assignment.

    Declaration
    public IDistribution NewDistribution(int temporalOrder)
    Parameters
    Type Name Description
    System.Int32 temporalOrder

    The order for the requested distribution.

    Returns
    Type Description
    IDistribution

    The new distribution.

    Remarks

    See NodeDistributions for more information.

    Note: if the resulting distribution contains continuous variables, but no discrete head variables, all table values are initialized to 1.

    See Also
    NodeDistributions

    ToString()

    Returns the name of the node, or an empty string if the name is null.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String containing the name of the node which is empty if the name is null.

    Overrides
    System.Object.ToString()

    Events

    PropertyChanged

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    System.ComponentModel.PropertyChangedEventHandler

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    Network
    Link
    In This Article
    Back to top Copyright Bayes Server Ltd. All rights Reserved.