当前位置: 首页>>代码示例>>C#>>正文


C# Node.getId方法代码示例

本文整理汇总了C#中Node.getId方法的典型用法代码示例。如果您正苦于以下问题:C# Node.getId方法的具体用法?C# Node.getId怎么用?C# Node.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Node的用法示例。


在下文中一共展示了Node.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Respond

    //Continues the conversation based on what the player responded
    public override void Respond(Response response)
    {
        if(debug)
            Debug.Log("Previous Current Node: "+currentNode.getId());

        currentNode = g.getNode(response.getNextNode());

        if(debug)
            Debug.Log("Current Node: "+currentNode.getId());
    }
开发者ID:srfoster,项目名称:CodeSpells,代码行数:11,代码来源:GraphConversation.cs

示例2: run

        public double run(Node tree1, Node tree2)
        {
            initialize(tree1, tree2);

            //The root nodes need to have the same label
            if (tree1.getId() == tree2.getId())
            {
                //Find the size of the isomorphism
                int res = topDownUnorderedMaxCommonSubtreeIso(tree1, tree2);

                //The similarity between the two trees.
                return similarity(tree1.Size, tree2.Size, res);
            }
            return 0;
        }
开发者ID:jaywant1503,项目名称:code-plagiarism-detector,代码行数:15,代码来源:AstSimLcs.cs

示例3: RangeQuery

        private int RangeQuery(Point center, float range, Node<int> node)
        {
            Circle coverRange = new Circle(center, range);
            int resultCount = 0;

            if (Intersect(node.getMBR(), new Circle(center, range)))
            {
                if (node.isLeaf())
                {
                    resultCount = node.getEntryCount();
                }
                else
                {
                    for (int i = 0; i < node.getEntryCount(); i++)
                    {
                        int childId = node.getId(i);
                        Node<int> childNode = rtree.NodeMap[childId];
                        resultCount += RangeQuery(center, range, childNode);
                    }
                }
            }

            return resultCount;
        }
开发者ID:wangchj,项目名称:geo-store-sim,代码行数:24,代码来源:RTreeQueryEvaluator.cs

示例4: topDownUnorderedMaxCommonSubtreeIso

        public int topDownUnorderedMaxCommonSubtreeIso(Node r1, Node r2)
        {
            //Cannot find a isomophism when the labels differ
            if (r1.getId() != r2.getId())
            {
                return 0;
            }

            //The isomorphism has size 0 or 1 if one of the nodes are leaf nodes
            if (r1.isLeaf() || r2.isLeaf())
            {
                return (r1.getId() == r2.getId()) ? 1 : 0;
            }

            int result;

            Node rp1 = r1.Parent;
            Node rp2 = r2.Parent;

                //Use LCS if r1 and r2 are root nodes in subtrees that represents method bodies.
            if ((rp1 != null && r1.getId() == SyntaxKind.Block && rp1.getId() == SyntaxKind.MethodDeclaration)
                && (rp2 != null && r2.getId() == SyntaxKind.Block && rp2.getId() == SyntaxKind.MethodDeclaration))
            {
                int res = lcs(r1, r2);
                result = res;
            }
            else
            {
                int p = r1.Size;
                int q = r2.Size;

                //Each child of r1 has a corresponding vertex in the bipartite graph. A map from node to vertex.
                Dictionary<Node, Vertex> T1G = new Dictionary<Node, Vertex>(p);
                //Each child of r2 has a corresponding vertex in the bipartite graph. A map from node to vertex.
                Dictionary<Node, Vertex> T2G = new Dictionary<Node, Vertex>(q);
                //A map from vertex to node.
                Dictionary<Vertex, Node> GT = new Dictionary<Vertex, Node>(p + q);

                //There is maximum p*q edges in the bipartite graph.
                List<Edge> edges = new List<Edge>(p * q);

                //The vertices that represents the children of r1.
                List<Vertex> U = new List<Vertex>(p);

                foreach (Node v1 in r1.Children)
                {
                    //q is the number of neighbors that v can have in the bipartite graph.
                    Vertex v = new Vertex(q);

                    U.Add(v);

                    GT.Add(v, v1);
                    T1G.Add(v1, v);
                }

                //The vertices that represents the children of r2.
                List<Vertex> W = new List<Vertex>(q);

                foreach (Node v2 in r2.Children)
                {
                    //p is the number of neighbors that w can have in the bipartite graph.
                    Vertex w = new Vertex(p);

                    W.Add(w);

                    GT.Add(w, v2);
                    T2G.Add(v2, w);
                }

                //List of matched edges
                List<Edge> list = null;

                foreach (Node v1 in r1.Children)
                {
                    foreach (Node v2 in r2.Children)
                    {

                        //Find max common subtree between v1 and v2
                        int res = topDownUnorderedMaxCommonSubtreeIso(v1, v2);

                        //If max common subtree
                        if (res != 0)
                        {
                            Vertex v = T1G[v1];

                            //Insert edge between v1 and v2
                            Edge e = v.insertEdge(T2G[v2]);

                            //Set cost of edge to res (size of max common subtree)
                            e.setCost(res);

                            edges.Add(e);
                        }
                    }
                }

                //Find the children of r1 and r2 that are part of r1's and r2's max common subtree
                BipartiteMatching bm = new BipartiteMatching();
                list = bm.maxWeightBipartiteMatching(U, W, edges, p, q);

//.........这里部分代码省略.........
开发者ID:jaywant1503,项目名称:code-plagiarism-detector,代码行数:101,代码来源:AstSimLcs.cs


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