Bevisuali.UX.Graph.GraphInspector.SetGraph C# (CSharp) Метод

SetGraph() публичный Метод

Assigns a network to this graph inspector. The graph inspector uses this network's local probability descriptions and structure. Layout must be updated separately.
public SetGraph ( BayesianNetwork network, string>.IDictionary variableAbbreviations ) : void
network BayesianNetwork
variableAbbreviations string>.IDictionary
Результат void
        public void SetGraph(
            BayesianNetwork network,
            IDictionary<string, string> variableAbbreviations)
        {
            bool isNewNetwork = _network != network;

            // Remove nodes and edges.
            foreach (var node in _nodes.ToList())
            {
                RemoveNode(node);
            }
            _nodes.Clear();

            // Remember.
            _network = network;

            if (network == null)
            {
                return;
            }

            // Generate new nodes.
            foreach (var variable in network.VariablesOrdered)
            {
                GraphNode node = new GraphNode();
                node.Label = variableAbbreviations[variable.Name];
                node.Tag = variable;
                node.ColorSpace = variable.Space.Values.Select(v => variable.Space.GetColor(v)).ToArray();

                var cpt = variable.Distributions;
                AddNode(node);
            }

            UpdateEdges();

            network.StructureChanged += OnBayesianNetworkStructureChanged;
        }