• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVertex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IVertex的典型用法代码示例。如果您正苦于以下问题:C# IVertex类的具体用法?C# IVertex怎么用?C# IVertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVertex类属于命名空间,在下文中一共展示了IVertex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PathRecord

 public PathRecord(IVertex target, double weight, IList<IEdge> edgeTracks)
 {
     Target = target;
     Weight = weight;
     EdgeTracks = edgeTracks.ToArray();
     ParseVertexTracks(edgeTracks);
 }
开发者ID:lurongkai,项目名称:SuperNet,代码行数:7,代码来源:PathRecord.cs


示例2: VertexRegister

 internal VertexRegister(IVertex currentVertex)
 {
     Vertex = currentVertex;
     Registed = false;
     TotalWeight = double.MaxValue;
     EdgeTracks = new List<IEdge>();
 }
开发者ID:lurongkai,项目名称:SuperNet,代码行数:7,代码来源:VertexRegister.cs


示例3: Push

 /// <summary>
 /// Push a new vertex on the buffer.
 /// </summary>
 /// <param name="v">new vertex</param>
 public override void Push(IVertex v)
 {
     // add to queue
     base.Push(v);
     // sort queue
     Sort(m_Comparer);
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:11,代码来源:PriorithizedVertexBuffer.cs


示例4: Visit

		private static void Visit(IVertex node, ColorsSet colors,
								  TimestampSet discovery, TimestampSet finish, LinkedList<IVertex> list, ref int time)
		{
			colors.Set(node, VertexColor.Gray);

			discovery.Register(node, time++);

			foreach(IVertex child in node.Adjacencies)
			{
				if (colors.ColorOf(child) == VertexColor.White)
				{
					Visit(child, colors, discovery, finish, list, ref time);
				}
			}

			finish.Register(node, time++);

#if DEBUG
			Debug.Assert(discovery.TimeOf(node) < finish.TimeOf(node));
#endif

			list.AddFirst(node);

			colors.Set(node, VertexColor.Black);
		}
开发者ID:gschuager,项目名称:Castle.Windsor,代码行数:25,代码来源:TopologicalSortAlgo.cs


示例5: FanMotif

        public FanMotif(IVertex headVertex,IVertex[] leafVertices)
        {
            m_oHeadVertex = headVertex;
            m_aoLeafVertices = leafVertices;
            m_dArcScale = 1.0;

        }
开发者ID:2014-sed-team3,项目名称:term-project,代码行数:7,代码来源:FanMotif.cs


示例6: CheckInnerPoint

        // Kiem tra 1 diem co nam trong da giac khong
        public static bool CheckInnerPoint(IVertexCollection points, IVertex point)
        {
            IVertex currentPoint = point;
            //Ray-cast algorithm is here onward
            int k, j = points.Count - 1;
            var oddNodes = false; //to check whether number of intersections is odd

            for (k = 0; k < points.Count; k++)
            {
                //fetch adjucent points of the polygon
                IVertex polyK = points[k];
                IVertex polyJ = points[j];

                //check the intersections
                if (((polyK.Y > currentPoint.Y) != (polyJ.Y > currentPoint.Y)) &&
                 (currentPoint.X < (polyJ.X - polyK.X) * (currentPoint.Y - polyK.Y) / (polyJ.Y - polyK.Y) + polyK.X))
                    oddNodes = !oddNodes; //switch between odd and even
                j = k;
            }

            //if odd number of intersections
            if (oddNodes)
            {
                //mouse point is inside the polygon
                return true;
            }

            //if even number of intersections
            return false;
        }
开发者ID:panoti,项目名称:DADHMT_LTW,代码行数:31,代码来源:Util.cs


示例7: Quad

 public Quad()
 {
     Vertices = new IVertex[]
     {
             new Vertex
                 {
                     Position = new Vector3(-1f, -1f, 0f),
                     Color = Color.White,
                     Texcoords = new Texcoords(new Vector2(0f, 0f))
                 },
             new Vertex
                 {
                     Position = new Vector3(1f, -1f, 0f),
                     Color = Color.White,
                     Texcoords = new Texcoords(new Vector2(1f, 0f))
                 },
             new Vertex
                 {
                     Position = new Vector3(1f, 1f, 0f),
                     Color = Color.White,
                     Texcoords = new Texcoords(new Vector2(1f, 1f))
                 },
             new Vertex
                 {
                     Position = new Vector3(-1f, 1f, 0f),
                     Color = Color.White,
                     Texcoords = new Texcoords(new Vector2(0f, 1f))
                 },
     };
     Indices = new short[] { 0, 1, 2, 0, 2, 3 };
 }
开发者ID:ananthonline,项目名称:graffiti,代码行数:31,代码来源:Quad.cs


示例8: VertexType

 /// <summary>
 /// Creates a new instance of VertexType.
 /// </summary>
 /// <param name="myVertexTypeVertex">An IVertex that represents the vertex type.</param>
 internal VertexType(IVertex myVertexTypeVertex)
     : base(myVertexTypeVertex)
 {
     _hasOwnUniques = HasOutgoingEdge(AttributeDefinitions.VertexTypeDotUniquenessDefinitions);
     _hasOwnIndices = HasIncomingVertices(BaseTypes.Index, AttributeDefinitions.IndexDotDefiningVertexType);
     _hasChilds = HasIncomingVertices(BaseTypes.VertexType, AttributeDefinitions.VertexTypeDotParent);
 }
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:VertexType.cs


示例9: Add

        public void Add(IVertex current_node, double current_distance, UInt64 current_depth)
        {
            var id = current_node.VertexID;
            _buffer.Add(Tuple.Create(current_distance, id), Tuple.Create(current_node, current_distance, current_depth));

            _count++;
        }
开发者ID:anukat2015,项目名称:sones,代码行数:7,代码来源:BufferDijkstra.cs


示例10: ExecFunc

        /// <summary>
        /// Executes the function on myCallingObject
        /// </summary>
        public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
        {
            var currentInnerEdgeType = ((IOutgoingEdgeDefinition)myAttributeDefinition).InnerEdgeType;

            if (myCallingObject is IHyperEdge && currentInnerEdgeType.HasProperty("Weight"))
            {
                var hyperEdge = myCallingObject as IHyperEdge;

                if (currentInnerEdgeType.HasProperty("Weight"))
                {
                    var weightProperty = currentInnerEdgeType.GetPropertyDefinition("Weight");

                    var maxWeight = hyperEdge.InvokeHyperEdgeFunc<Double>(singleEdges =>
                    {
                        return Convert.ToDouble(
                            weightProperty.GetValue(
                            singleEdges
                            .OrderByDescending(edge => weightProperty.GetValue(edge))
                            .First()));
                    });

                    return new FuncParameter(maxWeight);

                }
            }

            throw new InvalidTypeException(myCallingObject.GetType().ToString(), "Weighted IHyperEdge");
        }
开发者ID:loubo,项目名称:sones,代码行数:31,代码来源:MaxWeightFunc.cs


示例11: ExecFunc

        public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
        {
            if (!(myCallingObject is String))
            {
                throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
            }

            var pos = Convert.ToInt32(myParams[0].Value);

            StringBuilder resString = new StringBuilder();
            bool dontInsert = false;

            if (pos > (myCallingObject as String).Length)
            {
                dontInsert = true;
                resString.Append((myCallingObject as String).ToString());
            }
            else
            {
                resString.Append((myCallingObject as String).ToString().Substring(0, pos));
            }

            foreach (FuncParameter fp in myParams.Skip(1))
            {
                resString.Append(fp.Value as String);
            }

            if(!dontInsert)
                resString.Append((myCallingObject as String).ToString().Substring(pos));

            return new FuncParameter(resString.ToString());
        }
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:InsertFunc.cs


示例12: AddRange

		/// <summary>
		/// Adds the elements of an array to the end of this VertexCollection.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the end of this VertexCollection.
		/// </param>
		public  void AddRange(IVertex[] items)
		{
			foreach (IVertex item in items)
			{
				this.List.Add(item);
			}
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:13,代码来源:VertexCollection.cs


示例13: ReducePathDistance

 public void ReducePathDistance(IVertexDistanceMatrix distances, IVertex source, IVertex target, IVertex intermediate)
 {
     if ((source == target) && (distances.Distance(source, target) < 0.0))
     {
         throw new Exception("Negative cycle");
     }
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:7,代码来源:FloydWarshallNegativeCycleDistanceReducer.cs


示例14: BuildEstablishment

        public IEstablishment BuildEstablishment(IVertex vertex, IPlayer owner)
        {
            if (vertex == null)
                throw new ArgumentNullException(nameof(vertex));
            if (owner == null)
                throw new ArgumentNullException(nameof(owner));
            if (!Vertices.Contains(vertex))
                throw new ArgumentException("Did not find the passed vertex on the board");
            if (establishments.Any(e => e.Vertex == vertex))
                throw new ArgumentException("Invalid vertex, already an establishment here");

            var vertices = Vertices.Where(v => v.IsAdjacentTo(vertex));
            var tiles = Tiles.Where(t => t.IsAdjacentTo(vertex));
            if (establishments.Any(e => vertices.Contains(e.Vertex)))
                throw new ArgumentException("Invalid vertex, establishment can't be placed next to another establishment");
            if (tiles.All(t => t.Rawmaterial == MaterialType.Sea))
                throw new ArgumentException("Can't place an establishment on sea!");

            if (establishments.Count(e => e.Owner == owner) >= 2 &&
                roads.Where(r => r.Owner == owner).All(r => !r.Edge.IsAdjacentTo(vertex)))
                throw new InvalidOperationException("Each player can only build 2 houses without adjacent roads!");

            var establishment = new Establishment(owner, vertex);
            establishments.Add(establishment);


            logger.Info($"Establisment Build; Player {owner.Name}, {vertex.ToString()}");

            return establishment;
        }
开发者ID:Corne,项目名称:VOC,代码行数:30,代码来源:Board.cs


示例15: ChildVertices

        /// <summary>
        /// Gets an enumerable collection of child <see cref="IVertex"/>
        /// </summary>
        /// <param name="v">current <see cref="IVertex"/></param>
        /// <returns>An enumerable collection of adjacent vertices</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="v"/> is a null reference
        /// </exception>
        public IVertexEnumerable ChildVertices(IVertex v)
        {
            if (v==null)
                throw new ArgumentNullException("v");

            return new TargetVertexEnumerable(this.Wrapped.OutEdges(v));
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:15,代码来源:TreeAdaptorGraph.cs


示例16: CreateTriangle

        /// <summary>
        /// Create a new triangle with 3 new edge 
        /// </summary>
        /// <param name="vert1"></param>
        /// <param name="vert2"></param>
        /// <param name="vert3"></param>
        /// <param name="he1"></param>
        /// <param name="he2"></param>
        /// <param name="he3"></param>
        public static void CreateTriangle( IVertex<float> vert1, IVertex<float> vert2, IVertex<float> vert3,
            out Half_Edge he1, out Half_Edge he2, out Half_Edge he3 )
        {
            // create the new triangle
            he1 = new Half_Edge();
            he2 = new Half_Edge();
            he3 = new Half_Edge();

            // CCW test
            if ( ( ( vert2.X - vert1.X ) * ( vert3.Y - vert1.Y ) - ( vert3.X - vert1.X ) * ( vert2.Y - vert1.Y ) ) > 0 ) {
                he1.NextEdge = he2;
                he2.NextEdge = he3;
                he3.NextEdge = he1;
            } else {
                he1.NextEdge = he3;
                he3.NextEdge = he2;
                he2.NextEdge = he1;
            }

            // set the vertex
            he1.StartVertex = vert1;
            he2.StartVertex = vert2;
            he3.StartVertex = vert3;

            // set null the twin edge
            he1.TwinEdge = null;
            he2.TwinEdge = null;
            he3.TwinEdge = null;
        }
开发者ID:fxbit,项目名称:FxMath,代码行数:38,代码来源:Half_Edge.cs


示例17: AddVertices

        //*************************************************************************
        //  Method: AddVertices()
        //
        /// <summary>
        /// Adds a specified number of <see cref="Vertex" /> objects to a graph
        /// using the <see cref="IVertexCollection.Add(IVertex)" /> method.
        /// </summary>
        ///
        /// <param name="oGraph">
        /// Graph to add vertices to.
        /// </param>
        ///
        /// <param name="iVerticesToAdd">
        /// Number of vertices to add.
        /// </param>
        ///
        /// <returns>
        /// An array of the added vertices.
        /// </returns>
        //*************************************************************************
        public static IVertex[] AddVertices(
            IGraph oGraph,
            Int32 iVerticesToAdd
            )
        {
            Debug.Assert(oGraph != null);
            Debug.Assert(iVerticesToAdd >= 0);

            IVertex[] aoVertices = new IVertex[iVerticesToAdd];

            IVertexCollection oVertexCollection = oGraph.Vertices;

            // Add the vertices.

            for (Int32 i = 0; i < iVerticesToAdd; i++)
            {
            IVertex oVertex = aoVertices[i] = new Vertex();

            oVertex.Name = oVertex.ID.ToString();

            oVertexCollection.Add(oVertex);
            }

            return (aoVertices);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:45,代码来源:TestGraphUtil.cs


示例18: Augment

 internal void Augment(IVertex src, IVertex sink)
 {
     IEdge edge = null;
     IVertex vertex = null;
     double maxValue = double.MaxValue;
     edge = base.Predecessors.get_Item(sink);
     do
     {
         maxValue = Math.Min(maxValue, base.ResidualCapacities.get_Item(edge));
         vertex = edge.get_Source();
         edge = base.Predecessors.get_Item(vertex);
     }
     while (vertex != src);
     edge = base.Predecessors.get_Item(sink);
     do
     {
         EdgeDoubleDictionary dictionary;
         IEdge edge2;
         EdgeDoubleDictionary dictionary2;
         IEdge edge3;
         (dictionary = base.ResidualCapacities).set_Item(edge2 = edge, dictionary.get_Item(edge2) - maxValue);
         (dictionary2 = base.ResidualCapacities).set_Item(edge3 = base.ReversedEdges.get_Item(edge), dictionary2.get_Item(edge3) + maxValue);
         vertex = edge.get_Source();
         edge = base.Predecessors.get_Item(vertex);
     }
     while (vertex != src);
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:27,代码来源:EdmondsKarpMaximumFlowAlgorithm.cs


示例19: Successor

 public virtual IEdge Successor(IImplicitGraph g, IVertex u)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (u == null)
     {
         throw new ArgumentNullException("u");
     }
     int num = g.OutDegree(u);
     double num2 = 0.0;
     IEdgeEnumerator enumerator = g.OutEdges(u).GetEnumerator();
     while (enumerator.MoveNext())
     {
         IEdge edge = enumerator.get_Current();
         num2 += this.weights.get_Item(edge);
     }
     double num3 = this.rnd.NextDouble() * num2;
     double num4 = 0.0;
     double num5 = 0.0;
     IEdgeEnumerator enumerator2 = g.OutEdges(u).GetEnumerator();
     while (enumerator2.MoveNext())
     {
         IEdge edge2 = enumerator2.get_Current();
         num5 = num4 + this.weights.get_Item(edge2);
         if ((num3 >= num4) && (num3 <= num5))
         {
             return edge2;
         }
         num4 = num5;
     }
     return null;
 }
开发者ID:NigelThorne,项目名称:ndependencyinjection,代码行数:34,代码来源:WeightedMarkovEdgeChain.cs


示例20: ColorsSet

		public ColorsSet(IVertex[] items)
		{
			foreach(IVertex item in items)
			{
				Set(item, VertexColor.White);
			}
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:7,代码来源:GraphSets.cs



注:本文中的IVertex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVertexSource类代码示例发布时间:2022-05-24
下一篇:
C# IVersionSpec类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap