本文整理汇总了C#中INetwork类的典型用法代码示例。如果您正苦于以下问题:C# INetwork类的具体用法?C# INetwork怎么用?C# INetwork使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INetwork类属于命名空间,在下文中一共展示了INetwork类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveUnusedNodes
private void RemoveUnusedNodes(INetwork network)
{
if (allowRemoveUnusedNodes)
{
NetworkHelper.RemoveUnusedNodes(network);
}
}
示例2: ModifyIsDirectedProperty
public void ModifyIsDirectedProperty(INetwork network, bool isDirected)
{
if (network != null && network is BasicAdjList)
{
ModifyIsDirectedProperty(network as BasicAdjList, isDirected);
}
}
示例3: ToDataTable
public DataTable ToDataTable(INetwork network)
{
if (network == null)
throw new ArgumentNullException("network", "The input network must not be null.");
if (!(network is IEdgeAttributes))
throw new ArgumentException(string.Format("The input network must implement {0}.", typeof(IEdgeAttributes).Name), "network");
IEdgeAttributes src = network as IEdgeAttributes;
DataTable table = new DataTable("Edge data");
AttributeListMgr mgr = src.EdgeAttributeMgr as AttributeListMgr;
if (mgr == null)
throw new ArgumentException("The EdgeAttributeMgr of the input network must not be null.", "network");
string[] colNames = EnsureUniqueColNames(mgr);
int ctr = 0;
foreach (IAttributeList list in mgr.Lists)
{
table.Columns.Add(new DataColumn(colNames[ctr++], list.DataType));
}
if (table.Columns.Count>0)
for (int i = 0; i < mgr.Depth; i++)
{
table.Rows.Add(mgr.GetRow(i));
}
table.AcceptChanges();
return table;
}
示例4: CellNet
public CellNet(INetwork network, ModelVisual3D mophology, Dictionary<Guid, ICell> cells, Dictionary<Guid, ICellNet> childcellnet)
{
this.network = network;
this.mophology = mophology;
this.cells = cells;
this.childcellnet = childcellnet;
IsPushing = true;
var transforms = new Transform3DGroup();
Rotate = new RotateTransform3D(new QuaternionRotation3D());
Translate = new TranslateTransform3D(network.Position.X, network.Position.Y, network.Position.Z);
Scale = new ScaleTransform3D();
transforms.Children.Add(Rotate);
transforms.Children.Add(Translate);
transforms.Children.Add(Scale);
Mophology.Transform = transforms;
var binding = new Binding()
{
Source = network,
Path = new PropertyPath("Position"),
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(this, CellNet.PositionProperty, binding);
}
示例5: GetProperties
public string GetProperties(INetwork network)
{
var sb = new StringBuilder();
if (network == null)
{
sb.AppendLine("network is null");
}
else
{
ListPropertiesOfNetworkBase(network, sb);
if (network is IAdjList)
{
ListPropertiesOfAdjList((IAdjList)network, sb);
}
else
{
var isMatrix = network.GetType().GetInterfaces()
.Where(t => t.IsGenericType)
.Select(t => t.GetGenericTypeDefinition())
.Any(t => t.Equals(typeof(IMatrix<>)));
if (isMatrix)
ListPropertiesOfMatrix(network, sb);
}
}
return sb.ToString();
}
示例6: CreateCopier
/// <summary>
/// Creates an instance of ICopyNetwork appropriate to the underlying
/// Type of <paramref name="network"/>.
/// The returned object can be used to create a copy of the input network.
/// </summary>
/// <param name="network">The network to be copied.</param>
/// <returns>An ICopyNetwork instance</returns>
public ICopyNetwork CreateCopier(INetwork network)
{
ICopyNetwork tool = null;
if (network != null)
{
if (network is BlueSpider.Blob.Regular.Network.AdjList.SimpleAdjList)
{
tool = new BlueSpider.Blob.Regular.Network.AdjList.SimpleAdjListCopier();
}
else if (network is AdjList)
{
tool = new AdjacentList.Y.AdjListCopier();
}
else if (network is Matrix.CSpace.DirectedNetworkMatrix)
{
tool = new Matrix.CSpace.MatrixCopier();
}
else if (network is Matrix.CSpace.UnDirectedNetworkMatrix)
{
tool = new Matrix.CSpace.MatrixCopier();
}
else if (network is BlueSpider.Blob.Regular.Network.Matrix.SimpleFullMatrix)
{
throw new NotImplementedException();
}
else if (network is BlueSpider.Blob.Regular.Network.Matrix.SimpleSymmetricMatrix)
{
throw new NotImplementedException();
}
}
return tool;
}
示例7: DummyInputNetworkPort
/// <summary>
/// Initializes a new instance of the DummyInputNetworkPort class, This class maintains the dataObj
/// as a member, does NOT use the backingStore of the pipe.
/// </summary>
/// <param name="parent"></param>
/// <param name="inPipe"></param>
/// <param name="dataObj"></param>
/// <param name="isValid"></param>
public DummyInputNetworkPort(IElement parent, INetworkPipe inPipe, INetwork dataObj, bool isValid)
{
_parent = parent;
_inPipe = inPipe;
_netObj = dataObj;
_IsValid = isValid;
}
示例8: World
public World(INetwork network)
: base(0, 0, 1000, 1000)
{
color = System.Drawing.Brushes.White;
bigBrain = (FloatFastConcurrentNetwork)network;
size = height;
}
示例9: NetworkEvent
private NetworkEvent(INetwork network, IEventType type, IEventSource source)
{
Network = network;
Type = type;
TimeStamp = DateTime.UtcNow;
Source = source;
}
示例10: NetworkDispatcher
public NetworkDispatcher(ConcurrentQueue<Request> queue, INetwork network, ICache cache, IResponseDelivery delivery)
{
this.mQueue = queue;
this.mNetwork = network;
this.mCache = cache;
this.mDelivery = delivery;
}
示例11: SetOrderForBranch
public static void SetOrderForBranch(INetwork network, IBranch branch)
{
// node is new if it is exclusive to branch
var connectionsFromNodeCount = branch.Source.IncomingBranches.Count + branch.Source.OutgoingBranches.Count;
var connectionsToNodeCount = branch.Target.IncomingBranches.Count + branch.Target.OutgoingBranches.Count;
if (connectionsFromNodeCount == 1 && connectionsToNodeCount == 1)
{
// new branch, not connected (do not assign -1 since user might have assigned it when constructing object)
return;
}
if(connectionsFromNodeCount > 2 || connectionsToNodeCount > 2)
{
branch.OrderNumber = -1;
return;
}
if (connectionsFromNodeCount == 1 && connectionsToNodeCount == 2)
{
branch.OrderNumber = ComputeMaximumOrderForNode(network, branch.Target);
return;
}
if (connectionsFromNodeCount == 2 && connectionsToNodeCount == 1)
{
branch.OrderNumber = ComputeMaximumOrderForNode(network, branch.Source);
return;
}
}
示例12: CopyNetwork
public INetwork CopyNetwork(INetwork source)
{
if (source == null)
throw new ArgumentNullException("source", "The network to be copied is null.");
if (!(source is IBasicAdjList))
throw new ArgumentException(
string.Format("The network to be copied must implement {0}.", typeof (IBasicAdjList).Name),
"source");
if (NewNetworkId == Guid.Empty)
NewNetworkId = Guid.NewGuid();
IBasicAdjList copy = null;
IBasicAdjList src = source as IBasicAdjList;
// copy the network; *Note this copies the network structure (nodes & edges) but
// does not structure or populate the attributes
using (var fac = new BasicAdjListFactory())
{
fac.IsDirected = src.IsDirected;
fac.EnableNodeDataAttributes = (CopyNodeData );
fac.EnableEdgeDataAttributes = (CopyEdgeData );
copy = fac.CreateNetwork(NewNetworkId, src.NodeCount) as IBasicAdjList;
copy.Name = src.Name != null ? string.Copy(src.Name) : null;
}
INode copySrcNode = null;
INode copyDestNode = null;
int srcNodeIndex = -1;
int destNodeIndex = -1;
IEdge copiedEdge = null;
for (int i = 0; i < src.Edges.Count; i++)
{
srcNodeIndex = src.Edges[i].SourceNode.Index;
destNodeIndex = src.Edges[i].DestinationNode.Index;
copySrcNode = copy.Nodes[srcNodeIndex];
copyDestNode = copy.Nodes[destNodeIndex];
copiedEdge = copy.CreateEdge(copySrcNode, copyDestNode);
}
using (var fac = new DataAttributeCopierProvider())
{
if (CopyNodeData && src.NodeData != null)
{
using (var copier = fac.GetCopier(src.NodeData))
{
copier.Copy(src.NodeData, copy.NodeData);
}
}
if (CopyEdgeData && src.EdgeData != null)
{
using (var copier = fac.GetCopier(src.EdgeData))
{
copier.Copy(src.EdgeData, copy.EdgeData);
}
}
}
return copy;
}
示例13: CreateWriter
/// <summary>
/// Creates and returns a writer.
/// </summary>
/// <param name="fileType">A <see cref="NetworkFileTypes"/> value specifying the intended output format.</param>
/// <param name="network">The source INetwork to be written.</param>
/// <returns>INetworkFileWriter</returns>
public static INetworkFileWriter CreateWriter(NetworkFileTypes fileType, INetwork network)
{
INetworkFileWriter writer = null;
if (network!=null)
{
switch (fileType)
{
case NetworkFileTypes.Pajek_Net:
if (network is IBasicAdjList)
writer = new PajekBasicAdjListWriter();
break;
case NetworkFileTypes.GraphML:
if (network is IBasicAdjList)
writer = new GraphMlBasicAdjListWriter();
break;
case NetworkFileTypes.NetDraw_VNA:
if (network is IBasicAdjList)
writer = new VNABasicAdjListWriter();
break;
default:
writer = null;
break;
}
}
return writer;
}
示例14: AgentBrain
public int numBrains; // Schrum: Total number
public AgentBrain(bool homogenous, int numAgents, SubstrateDescription substrateDescription, INetwork genome,
bool normalizeANNWeights, bool adaptableANN, bool modulatoryANN, bool multi, int brains, bool evolveSubstrate, bool preferenceNeurons, bool forcedSituationalPolicyGeometry)
{
this.evolveSubstrate = evolveSubstrate;
this.normalizeANNWeights = normalizeANNWeights;
this.adaptableANN = adaptableANN;
this.modulatoryANN = modulatoryANN;
this.genome = genome;
this.substrateDescription = substrateDescription;
this.numRobots = numAgents;
this.homogenous = homogenous;
this.multipleBrains = multi;
this.forcedSituationalPolicyGeometry = forcedSituationalPolicyGeometry;
// Schrum: When preference neurons are used, the number of modules in the network is the
// more reliable source of information. Especially if Module Mutation will allow more modules
// to be created, each creating a new brain.
this.numBrains = genome != null && preferenceNeurons ? genome.NumOutputModules : brains;
this.preferenceNeurons = preferenceNeurons;
//inputCounter = 0;
teamInput = new float[numAgents * substrateDescription.InputCount];
activated = new bool[numAgents];
createBrains();
robotListeners = new List<Robot>();
}
示例15: RequestQueue
public RequestQueue(ICache cache, INetwork network, int threadPoolSize, IResponseDelivery delivery)
{
this.mCache = cache;
this.mNetwork = network;
this.mDispatchers = new NetworkDispatcher[threadPoolSize];
this.mDelivery = delivery;
}