public NetworkLayoutRecord(
BayesianNetwork network,
NetworkLayout existingLayout,
IList<string> interestVertices,
NetworkLayoutOptions options)
{
Debug.Assert(options != null, "Layout options cannot be null.");
this.Network = network;
this.NetworkLayout = existingLayout;
this.InterestVertices = interestVertices.ToList();
this.Options = options;
// Manually specify sizes.
Dictionary<string, float> sizes = new Dictionary<string, float>();
foreach (var v in network.Variables)
{
if (!interestVertices.Contains(v.Key))
{
sizes[v.Key] = Workbench.NetworkLayoutVertexSizeMinimized;
}
else
{
sizes[v.Key] = Workbench.NetworkLayoutVertexSizeNormal;
}
}
this.AlgorithmState = new LayoutAlgorithm(network.Clone(), sizes, options);
// Copy existing positions over.
if (existingLayout != null && existingLayout.Positions != null && existingLayout.Positions.Count > 0)
{
foreach (var kvp in existingLayout.Positions)
{
AlgorithmState.Positions[kvp.Key] = kvp.Value;
}
}
}