本文整理汇总了Java中org.nodes.DTLink.tag方法的典型用法代码示例。如果您正苦于以下问题:Java DTLink.tag方法的具体用法?Java DTLink.tag怎么用?Java DTLink.tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nodes.DTLink
的用法示例。
在下文中一共展示了DTLink.tag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: countLabelTagPairs
import org.nodes.DTLink; //导入方法依赖的package包/类
/**
* Create a hubmap from a graph
*
* @param graph
* @return
*/
public static Map<LabelTagPair<String,String>, Integer> countLabelTagPairs(SingleDTGraph graph) {
Map<LabelTagPair<String,String>, Integer> edgeCounts = new HashMap<LabelTagPair<String,String>, Integer>();
Set<DTNode<String,String>> iNodes = new HashSet<DTNode<String,String>>(graph.getInstances());
for (DTLink<String,String> link : graph.getGraph().links()) {
if (!iNodes.contains(link.from())) { // instance nodes should not be hubs
LabelTagPair<String,String> heOut = new LabelTagPair<String,String>(link.from().label(), link.tag(), LabelTagPair.DIR_OUT);
if (!edgeCounts.containsKey(heOut)) {
edgeCounts.put(heOut, 0);
}
edgeCounts.put(heOut, edgeCounts.get(heOut)+1);
}
if (!iNodes.contains(link.to())) {
LabelTagPair<String,String> heIn = new LabelTagPair<String,String>(link.to().label(), link.tag(), LabelTagPair.DIR_IN);
if (!edgeCounts.containsKey(heIn)) {
edgeCounts.put(heIn, 0);
}
edgeCounts.put(heIn, edgeCounts.get(heIn)+1);
}
}
return edgeCounts;
}
示例2: countPathRec
import org.nodes.DTLink; //导入方法依赖的package包/类
private void countPathRec(SparseVector fv, DTLink<String,String> edge, String path, int depth) {
// Count path
path = path + edge.tag();
if (!pathDict.containsKey(path)) {
pathDict.put(path, pathDict.size());
}
fv.setValue(pathDict.get(path), fv.getValue(pathDict.get(path)) + 1);
if (depth > 0) {
countPathRec(fv, edge.to(), path, depth-1);
}
}
示例3: countPathRec
import org.nodes.DTLink; //导入方法依赖的package包/类
private void countPathRec(SparseVector fv, DTLink<String,String> edge, String path, int depth) {
// Count path
path = path + edge.tag();
if (!pathDict.containsKey(path)) {
pathDict.put(path, pathDict.size());
}
fv.setValue(pathDict.get(path), fv.getValue(pathDict.get(path)) + 1);
if (depth > 0) {
countPathRec(fv, edge.to(), path, depth-1);
}
}