本文整理汇总了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());
}
示例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;
}
示例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;
}
示例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);
//.........这里部分代码省略.........