本文整理汇总了Java中y.base.Graph.edges方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.edges方法的具体用法?Java Graph.edges怎么用?Java Graph.edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类y.base.Graph
的用法示例。
在下文中一共展示了Graph.edges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendEdgesWithCondition
import y.base.Graph; //导入方法依赖的package包/类
public static String appendEdgesWithCondition(Graph hyperGraph,
Map<Node, String> nameMap, Condition condition) {
StringBuilder notation = new StringBuilder();
EdgeMap hyperEdgeMap = (EdgeMap) hyperGraph
.getDataProvider(EdgeMapKeys.DESCRIPTION);
EdgeCursor edges = hyperGraph.edges();
int edgeCount = 0;
for (; edges.ok(); edges.next()) {
String edgeDesc = (String) hyperEdgeMap.get(edges.edge());
boolean conditionValue = condition
.condition(new Object[] { edgeDesc });
if (edgeCount > 0 && conditionValue) {
notation.append(NotationCompositor.NOTATION_DELIMETER);
}
if (conditionValue) {
Node sourceNode = edges.edge().source();
Node targetNode = edges.edge().target();
notation.append(nameMap.get(sourceNode));
notation.append(NotationCompositor.NOTATION_COMMA);
notation.append(nameMap.get(targetNode));
notation.append(NotationCompositor.NOTATION_COMMA);
notation.append(edgeDesc);
edgeCount++;
}
}
return notation.toString();
}
示例2: getSelectedGraphManager
import y.base.Graph; //导入方法依赖的package包/类
public static GraphManagerInfo getSelectedGraphManager(GraphData graphData)
throws IOException, MonomerException, JDOMException {
GraphManagerInfo graphManagerInfo = new GraphManagerInfo();
GraphManager selectedGraphManager = new GraphManager();
// MonomerInfo monomerInfo = graphData.getMonomerInfo();
NodeMap newMonomerInfoMap = graphData.getNewMonomerInfoMap();
Graph graph = graphData.getGraph();
Node newNode = null;
Monomer monomer = null;
NodeList specialBases = new NodeList();
// GraphCopier gc = new GraphCopier();
// Graph temp = gc.copy(graph, nodes);
GraphHider gh = new GraphHider(graph);
// hide pairings and chem edges
EdgeMap edgeMap = (EdgeMap) graph
.getDataProvider(EdgeMapKeys.EDGE_INFO);
for (EdgeCursor ec = graph.edges(); ec.ok(); ec.next()) {
Edge e = ec.edge();
EdgeInfo einfo = (EdgeInfo) edgeMap.get(e);
if (einfo.isPair()) {
gh.hide(ec.edge());
}
if (MonomerInfoUtils.isChemicalModifierPolymer(e.source())
|| MonomerInfoUtils.isChemicalModifierPolymer(e.target())) {
gh.hide(e);
}
if (MonomerInfoUtils.isPBranchEdge(e)) {
gh.hide(e);
}
}
for (NodeCursor nodes = graph.nodes(); nodes.ok(); nodes.next()) {
newNode = nodes.node();
MonomerInfo monomerInfo = (MonomerInfo) newMonomerInfoMap.get(nodes
.node());
monomer = GraphUtils.getMonomerDB()
.get(monomerInfo.getPolymerType())
.get(monomerInfo.getMonomerID());
if (newNode.inDegree() == 0) {
if (monomer != null
&& MonomerInfoUtils.isBranchMonomer(monomer)) {
specialBases.add(newNode);
} else {
selectedGraphManager.addStartingNode(nodes.node());
}
}
}
NodeList[] components = GraphConnectivity.connectedComponents(graph);
for (NodeList component : components) {
GraphCopier gc = new GraphCopier();
Graph temp = gc.copy(graph, component.nodes());
if (GraphChecker.isCyclic(temp)) {
selectedGraphManager.addStartingNode(component.firstNode());
}
}
gh.unhideAll();
graphManagerInfo.setGraphManager(selectedGraphManager);
graphManagerInfo.setSpecialBases(specialBases);
return graphManagerInfo;
}