• Manual
  • HAPI Namespace
Show / Hide Table of Contents
  • HAPI
    • AbsExpression
    • AddExpression
    • AggregateExpression
    • AndExpression
    • Attribute
    • BetaDistribution
    • BinomialDistribution
    • BooleanDCNode
    • BooleanDDNode
    • BooleanDFNode
    • BooleanExpression
    • CeilExpression
    • Class
    • ClassCollection
    • ClassList
    • ClassParseListener
    • Clique
    • CliqueList
    • CompositeExpression
    • ConstantExpression
    • ContinuousChanceNode
    • CosExpression
    • CoshExpression
    • DataSet
    • DefaultClassParseListener
    • DiscreteChanceNode
    • DiscreteDecisionNode
    • DiscreteFunctionNode
    • DiscreteNode
    • DistributionDistribution
    • DivideExpression
    • Domain
    • Domain.Equilibrium
    • Domain.EvidenceMode
    • Domain.TriangulationMethod
    • EqualsExpression
    • ExceptionArgumentNotAlive
    • ExceptionBadKBFormat
    • ExceptionBadKBPassword
    • ExceptionBadKBVersion
    • ExceptionCGEvidenceIncorporated
    • ExceptionCGLIMIDsNotSupported
    • ExceptionCaseStateTooLarge
    • ExceptionChainGraph
    • ExceptionCompressed
    • ExceptionComputationFailed
    • ExceptionCyclicFunctionalDependency
    • ExceptionCyclicInstanceHierarchy
    • ExceptionCyclicNetwork
    • ExceptionDemo
    • ExceptionDivisionByZero
    • ExceptionEnumeration
    • ExceptionError
    • ExceptionExpiredLicense
    • ExceptionFastRetraction
    • ExceptionFunctionalDependency
    • ExceptionHugin
    • ExceptionIO
    • ExceptionIllegalBinding
    • ExceptionInappropriateArguments
    • ExceptionInconsistencyOrUnderflow
    • ExceptionInsufficientStateRange
    • ExceptionInvalidEvidence
    • ExceptionInvalidExpression
    • ExceptionInvalidLicense
    • ExceptionInvalidName
    • ExceptionInvalidProbabilityPotential
    • ExceptionInvalidStateValues
    • ExceptionLocale
    • ExceptionLowDensity
    • ExceptionMemory
    • ExceptionNoEquilibrium
    • ExceptionNoValue
    • ExceptionNormalization
    • ExceptionNotCompiled
    • ExceptionObjectNotAlive
    • ExceptionOverflow
    • ExceptionParse
    • ExceptionRounding
    • ExceptionSizeTooLarge
    • ExceptionSyntax
    • ExceptionTableTooLarge
    • ExceptionTwice
    • ExceptionUsage
    • ExceptionZeroVariance
    • ExpExpression
    • ExponentialDistribution
    • Expression
    • Expression.Operator
    • ExpressionList
    • FloorExpression
    • FunctionNode
    • GammaDistribution
    • GeometricDistribution
    • GreaterThanExpression
    • GreaterThanOrEqualsExpression
    • IfExpression
    • InstanceNode
    • IntervalDCNode
    • IntervalDDNode
    • IntervalDFNode
    • JunctionTree
    • JunctionTreeList
    • LabelExpression
    • LabelledDCNode
    • LabelledDDNode
    • LabelledDFNode
    • LessThanExpression
    • LessThanOrEqualsExpression
    • Log10Expression
    • Log2Expression
    • LogExpression
    • LogNormalDistribution
    • MaxExpression
    • MinExpression
    • ModExpression
    • Model
    • MultiplyExpression
    • NegateExpression
    • NegativeBinomialDistribution
    • NetworkModel
    • NetworkModel.Constraint
    • Node
    • Node.Category
    • Node.Kind
    • NodeExpression
    • NodeList
    • NoisyOrDistribution
    • NormalDistribution
    • NotEqualsExpression
    • NotExpression
    • NumberExpression
    • NumberedDCNode
    • NumberedDDNode
    • NumberedDFNode
    • NumericDiscreteNode
    • OrExpression
    • PERTDistribution
    • ParseListener
    • PoissonDistribution
    • PowerExpression
    • ProbabilityExpression
    • QuantileExpression
    • SinExpression
    • SinhExpression
    • SqrtExpression
    • StateIndexExpression
    • SubtractExpression
    • Table
    • TanExpression
    • TanhExpression
    • TriangularDistribution
    • TruncateExpression
    • UniformDistribution
    • UtilityNode
    • VarianceExpression
    • WeibullDistribution

Class NetworkModel

The NetworkModel class is an abstract class with two subclasses: Domain and Class.

Inheritance
object
NetworkModel
Class
Domain
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public abstract class NetworkModel

Constructors

NetworkModel()

Declaration
protected NetworkModel()

Methods

CloseLogFile()

Closes the log file associated with this NetworkModel.

Declaration
public void CloseLogFile()
Exceptions
Type Condition
ExceptionHugin

Delete()

Deletes this NetworkModel.

Declaration
public abstract void Delete()
Exceptions
Type Condition
ExceptionHugin

GenerateTables()

Generates the conditional probability tables for all nodes of this NetworkModel.

Declaration
public void GenerateTables()
Remarks

Generates the conditional probability tables for all nodes of this NetworkModel. This is done by calling GenerateTable() for all nodes having a model, so the descriptions of the GenerateTable method for DiscreteChanceNode and UtilityNode also apply here.

Exceptions
Type Condition
ExceptionHugin

GetAttribute(string)

Returns the value associated with a particular attribute in the attribute list for this NetworkModel.

Declaration
public string GetAttribute(string key)
Parameters
Type Name Description
string key

A String identifying the attribute in question.

Returns
Type Description
string

A String containing the attribute value.

Exceptions
Type Condition
ExceptionHugin

GetAttributes()

Returns the list of attributes associated with this NetworkModel.

Declaration
public List<Attribute> GetAttributes()
Returns
Type Description
List<Attribute>

The list of attributes associated with this NetworkModel.

Exceptions
Type Condition
ExceptionHugin

GetFileName()

Returns the file name most recently used for loading or saving this NetworkModel.

Declaration
public string GetFileName()
Returns
Type Description
string

The file name.

Exceptions
Type Condition
ExceptionHugin

GetLogFile()

Returns the name of the most recent log file opened by OpenLogFile(string, bool) or OpenLogFile(string).

Declaration
public string GetLogFile()
Returns
Type Description
string

String or null (if no log file has been opened or the most recent call to OpenLogFile(string, bool) or OpenLogFile(string) has been succeeded by a call to CloseLogFile().)

Exceptions
Type Condition
ExceptionHugin

GetNodeByName(string)

Returns a Node by name. If no node by the given name exists, null is returned.

Note: A special node naming scheme is applied when creating a runtime domain for OOBNs. For more on this, read Example 4: Node naming scheme for OOBNs.

Declaration
public Node GetNodeByName(string nodename)
Parameters
Type Name Description
string nodename

a string containing the name of the Node to be found in this NetworkModel.

Returns
Type Description
Node

A Node named name in this NetworkModel.

Exceptions
Type Condition
ExceptionHugin

GetNodeSize()

Returns the size of the displayed nodes.

Declaration
public Size GetNodeSize()
Returns
Type Description
Size

A Size (int width, int height).

Exceptions
Type Condition
ExceptionHugin

GetNodes()

Returns the Nodes of this NetworkModel.

Declaration
public NodeList GetNodes()
Returns
Type Description
NodeList

NodeList containing the Nodes of this NetworkModel.

Exceptions
Type Condition
ExceptionHugin

GetUserData()

Returns the value stored within the user data slot of this NetworkModel.

Declaration
public object GetUserData()
Returns
Type Description
object

The user data Object associated with this NetworkModel.

Remarks

Returns the value stored within the user data slot of this NetworkModel. If the stored value is null, or if no value has been stored, null is returned. It is the responsibility of the application programmer to ensure that the data is valid. Also note that when you delete a domain, Hugin does not attempt to delete the Object referenced by the user data slot. It is the responsibility of the user.

IsAlive()

Is this NetworkModel object alive?

Declaration
public bool IsAlive()
Returns
Type Description
bool

OpenLogFile(string)

Opens a log file to be associated with this NetworkModel. The file is opened in create mode.

Declaration
public void OpenLogFile(string filename)
Parameters
Type Name Description
string filename

The name of the log file.

Exceptions
Type Condition
ExceptionHugin

OpenLogFile(string, bool)

Opens a log file to be associated with this NetworkModel.

Declaration
public void OpenLogFile(string filename, bool append)
Parameters
Type Name Description
string filename

The name of the log file.

bool append

If true opens the log file in append mode; otherwise, opens in create mode.

Exceptions
Type Condition
ExceptionHugin

ParseNodes(string, ParseListener)

Parses file named fileName and returns a NodeList. This is used for reading an elimination order from a file.

Declaration
public NodeList ParseNodes(string fileName, ParseListener parseListener)
Parameters
Type Name Description
string fileName

The name of a file of node names.

ParseListener parseListener

The ParseListener used for handling parse errors.

Returns
Type Description
NodeList

A NodeList.

Exceptions
Type Condition
ExceptionHugin

SaveAsNet(string)

Writes a NET description of this NetworkModel to a file.

Declaration
public void SaveAsNet(string fileName)
Parameters
Type Name Description
string fileName

The name of the file in which to store the NET description.

Exceptions
Type Condition
ExceptionHugin

SetAttribute(string, string)

Inserts the key/value pair in the attribute list for this NetworkModel.

Declaration
public void SetAttribute(string key, string value)
Parameters
Type Name Description
string key

The key identifying the attribute to be updated.

string value

The value of the attribute.

Remarks

Inserts the key/value pair in the attribute list for this NetworkModel. If the key is already defined, the value is updated. If no value is provided, the attribute is removed.

Exceptions
Type Condition
ExceptionHugin

SetAttributes(List<Attribute>)

Sets the attributes of this NetworkModel to attributes.

Declaration
public void SetAttributes(List<Attribute> attributes)
Parameters
Type Name Description
List<Attribute> attributes

List of Attributes.

Exceptions
Type Condition
ExceptionHugin

SetNodeSize(Size)

Sets the size of the nodes.

Declaration
public void SetNodeSize(Size nodesize)
Parameters
Type Name Description
Size nodesize

A Size object with width and height of the Nodes in this NetworkModel.

Exceptions
Type Condition
ExceptionHugin

SetUserData(object)

Sets the user data field of this NetworkModel.

Declaration
public void SetUserData(object data)
Parameters
Type Name Description
object data

An Object, the user-defined data associated with this NetworkModel.

Remarks

Sets the user data field of this NetworkModel. The Hugin API provides a slot within each NetworkModel for use exclusively by the user/application. This slot can hold an instance of type Object, such as a String, a List{T}, etc. Please note that Hugin does not do anything to the user data. Data is not even copied. Only a reference to the data is stored.

ToNetString()

Creates a NET description of this NetworkModel.

Declaration
public string ToNetString()
Returns
Type Description
string

A string containing the NET description.

Exceptions
Type Condition
ExceptionHugin
In this article
Back to top Copyright (C) 2019-2025 Hugin Expert A/S