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


Java Graph类代码示例

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


Graph类属于y.base包,在下文中一共展示了Graph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: measure

import y.base.Graph; //导入依赖的package包/类
@Override
public double measure(Cover cover) throws InterruptedException {
	double metricValue = 0;
	Graph graph = cover.getGraph();
	NodeCursor nodesA = graph.nodes();
	NodeCursor nodesB = graph.nodes();
	Node nodeA;
	Node nodeB;
	while(nodesA.ok()) {
		nodeA = nodesA.node();
		nodesB.toFirst();
		while(nodesB.ok()) {
			nodeB = nodesB.node();
			metricValue +=
					getNodePairModularityContribution(cover, nodeA, nodeB);
			nodesB.next();
		}
			nodesA.next();
	}
	if(graph.edgeCount() > 0) {
		metricValue /= (graph.edgeCount() * 2);
	}
	return metricValue;
}
 
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:25,代码来源:ExtendedModularityMetricCoMembership.java

示例2: updatePairMap

import y.base.Graph; //导入依赖的package包/类
private static void updatePairMap(Edge edge, Graph graph, Graph hyperGraph) {
	NodeMap pairMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2PAIR_NODE);
	EdgeMap edgeInfo = (EdgeMap) graph
			.getDataProvider(EdgeMapKeys.EDGE_INFO);
	NodeMap parentNodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	NodeMap hyper2starting = (NodeMap) hyperGraph
			.getDataProvider(NodeMapKeys.HYPERNODE2STARTING_NODE);

	EditorEdgeInfoData info = (EditorEdgeInfoData) edgeInfo.get(edge);
	if (!info.isPair()) {
		return;
	}

	Node hyperSourceNode = (Node) parentNodeMap.get(edge.source());
	Node hyperTargetNode = (Node) parentNodeMap.get(edge.target());

	Node startingSource = (Node) hyper2starting.get(hyperSourceNode);
	Node startingTarget = (Node) hyper2starting.get(hyperTargetNode);

	pairMap.set(startingSource, startingTarget);
	pairMap.set(startingTarget, startingSource);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:25,代码来源:Graph2NotationTranslator.java

示例3: getExtendedNotation

import y.base.Graph; //导入依赖的package包/类
public String getExtendedNotation(GraphManager graphManager) {

		Graph hyperGraph = graphManager.getHyperGraph();
		if (hyperGraph.isEmpty()) {
			return EMPTY_STRING;
		}

		StringBuilder notation = new StringBuilder();

		Map<Node, String> nameMap = new HashMap<Node, String>();
		Object[] args = new Object[] { hyperGraph, nameMap };

		for (NotationCreator currCreator : _creators) {
			notation.append(currCreator.createNotationPart(args));
		}
		notation.append(NOTATION_PART_ENDING);

		return notation.toString();
	}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:20,代码来源:NotationCompositor.java

示例4: getSingleSuccessor

import y.base.Graph; //导入依赖的package包/类
protected Node getSingleSuccessor(Node n) {
	EdgeCursor edgeCursor = n.outEdges();
	Graph g = n.getGraph();
	EdgeMap type = (EdgeMap) g.getDataProvider(EdgeMapKeys.EDGE_INFO);

	for (; edgeCursor.ok(); edgeCursor.next()) {
		Edge e = edgeCursor.edge();
		EdgeInfo info = (EdgeInfo) type.get(e);
		if (info.isRegular() && !MonomerInfoUtils.isInterPolymer(e)) {
			return e.opposite(n);
		}
	}

	return null;

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:17,代码来源:AbstractSequenceTransformer.java

示例5: getSingleOutEdge

import y.base.Graph; //导入依赖的package包/类
protected Edge getSingleOutEdge(Node n) {
	EdgeCursor edgeCursor = n.outEdges();
	Graph g = n.getGraph();
	EdgeMap type = (EdgeMap) g.getDataProvider(EdgeMapKeys.EDGE_INFO);

	for (; edgeCursor.ok(); edgeCursor.next()) {
		Edge e = edgeCursor.edge();
		EdgeInfo info = (EdgeInfo) type.get(e);
		if (info.isRegular()) {
			return e;
		}
	}

	return null;

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:17,代码来源:AbstractSequenceTransformer.java

示例6: changeDirection

import y.base.Graph; //导入依赖的package包/类
private boolean changeDirection(Graph graph, Node sourceNode,
		Node targetNode) {
	if (!sameSequence(graph, sourceNode, targetNode)) {
		return false;
	}

	NodeMap positions = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_POSITION);
	Integer spos = (Integer) positions.get(sourceNode);
	if (spos == null) {
		return false;
	}
	Integer tpos = (Integer) positions.get(targetNode);
	if (tpos == null) {
		return false;
	}
	return (spos < tpos);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:19,代码来源:EditorCreateEdgeMode.java

示例7: hasComplementary

import y.base.Graph; //导入依赖的package包/类
/**
 * test if a strand starting with the given starting node CAN pair up with a
 * new complementary strand
 * 
 * @param startingNode
 * @return true: if each of the base node has free hydrogen bond connection,
 *         otherwise false.
 * @throws org.helm.notation.MonomerException
 * @throws org.jdom.JDOMException
 * @throws java.io.IOException
 */
private boolean hasComplementary(Node startingNode)
		throws MonomerException, JDOMException, IOException {
	NodeList baseList = SequenceGraphTools.getBaseList(startingNode,
			view.getGraph2D(), false);
	Node base = null;
	final Graph graph = view.getGraph2D();
	NodeMap nodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_REF);
	MonomerInfo monomerInfo = null;

	while (!baseList.isEmpty()) {
		base = baseList.popNode();
		monomerInfo = (MonomerInfo) nodeMap.get(base);
		if (monomerInfo.isConnected(monomerInfo
				.getAttachment(Attachment.PAIR_ATTACHMENT))) {
			return false;
		}
	}

	return true;

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:34,代码来源:MacromoleculeEditor.java

示例8: releaseConnection

import y.base.Graph; //导入依赖的package包/类
private void releaseConnection(Edge edge) {
	Graph graph = edge.getGraph();
	EdgeMap edgeMap = (EdgeMap) graph
			.getDataProvider(EdgeMapKeys.EDGE_INFO);
	NodeMap nodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_REF);

	EditorEdgeInfoData edgeInfoData = (EditorEdgeInfoData) edgeMap
			.get(edge);
	if (edgeInfoData == null) {
		return;
	}

	MonomerInfo sourceMonomerInfo = (MonomerInfo) nodeMap
			.get(edge.source());
	MonomerInfo targetMonomerInfo = (MonomerInfo) nodeMap
			.get(edge.target());

	sourceMonomerInfo.setConnection(edgeInfoData.getSourceNodeAttachment(),
			false);
	targetMonomerInfo.setConnection(edgeInfoData.getTargetNodeAttachment(),
			false);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:24,代码来源:DeleteAction.java

示例9: breaksComponent

import y.base.Graph; //导入依赖的package包/类
private boolean breaksComponent(Edge e) {
	Graph g = e.getGraph();
	NodeMap hyper = (NodeMap) g
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	NodeMap starting = (NodeMap) g
			.getDataProvider(NodeMapKeys.NODE2STARTING_NODE);
	if (hyper.get(e.source()) != hyper.get(e.target())) {
		// edge connects two different components,
		// so need to add another one
		return false;
	}

	GraphHider gh = new GraphHider(g);
	gh.hide(e);

	Node s = (Node) starting.get(e.source());
	NodeList accessibleNodes = GraphConnectivity.getSuccessors(g,
			new NodeList(s), g.N());
	// check if we still can access target node
	gh.unhideAll();
	return !accessibleNodes.contains(e.target());
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:23,代码来源:DeleteAction.java

示例10: getPaired

import y.base.Graph; //导入依赖的package包/类
private List<Node> getPaired(Node startNode) {
	NodeMap parentNodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	Graph hyperGraph = manager.getHyperGraph();
	EdgeMap hyperEdgeDescMap = (EdgeMap) hyperGraph
			.getDataProvider(EdgeMapKeys.DESCRIPTION);
	List<Node> startingNodeList = manager.getStartingNodeList();
	List<Node> result = new ArrayList<Node>();

	Node hyperNode1 = (Node) parentNodeMap.get(startNode);
	for (Node aStartingNodeList : startingNodeList) {
		Node hyperNode2 = (Node) parentNodeMap.get(aStartingNodeList);
		Edge hyperEdge = hyperNode1.getEdge(hyperNode2);
		if (hyperEdge != null) {
			String edgeDesc = (String) hyperEdgeDescMap.get(hyperEdge);
			if (edgeDesc.contains("pair")) {
				result.add(aStartingNodeList);
			}
		}
	}
	return result;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:23,代码来源:DirectionFinderImpl.java

示例11: createTypeNode

import y.base.Graph; //导入依赖的package包/类
private static Node createTypeNode(final BaseType baseType, final Graph graph,
    final BiMap<BaseType, Node> map) {
  final Node node = map.get(baseType);
  if (node == null) {
    final Node newNode = graph.createNode();
    map.put(baseType, newNode);
    return newNode;
  } else {
    return node;
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:12,代码来源:TypeDependenceGraph.java

示例12: reInsertBend

import y.base.Graph; //导入依赖的package包/类
@Override
public void reInsertBend(final Bend bend, final Bend refBend, final int dir) {

  final int index = ((bendPos(refBend) + dir) == Graph.BEFORE) || (refBend == null) ? 0 : 1;

  super.reInsertBend(bend, refBend, dir);

  for (final IZyEdgeRealizerListener<EdgeType> listener : m_listeners) {
    try {
      listener.insertedBend(index, bend.getX(), bend.getY());
    } catch (final Exception exception) {
      exception.printStackTrace();
    }
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:16,代码来源:ZyEdgeRealizer.java

示例13: measure

import y.base.Graph; //导入依赖的package包/类
@Override
public double measure(Cover cover) throws InterruptedException {
	double metricValue = 0;
	Graph graph = cover.getGraph();
	NodeCursor nodesA = graph.nodes();
	NodeCursor nodesB = graph.nodes();
	Node nodeA;
	Node nodeB;
	while(nodesA.ok()) {
		nodeA = nodesA.node();
		nodesB.toFirst();
		while(nodesB.ok()) {
			nodeB = nodesB.node();
			if(nodeB.index() > nodeA.index()) {
				break;
			}
			metricValue +=
					getNodePairModularityContribution(cover, nodesA.node(), nodesB.node());
			nodesB.next();
		}
			nodesA.next();
	}
	if(graph.edgeCount() > 0) {
		metricValue /= graph.edgeCount();
	}
	return metricValue;
}
 
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:28,代码来源:ExtendedModularityMetric.java

示例14: getGraphCopier

import y.base.Graph; //导入依赖的package包/类
/**
 * set up a graph copier for a given graph
 * 
 * @param graph
 * @return a GraphCopier object
 */
public static GraphCopier getGraphCopier(Graph graph) {
	GraphCopier copier = new GraphCopier(graph.getGraphCopyFactory());
	copier.setDataProviderContentCopying(true);
	copier.setEdgeMapCopying(true);
	copier.setNodeMapCopying(true);

	return copier;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:15,代码来源:SequenceGraphTools.java

示例15: checkDistance

import y.base.Graph; //导入依赖的package包/类
public static boolean checkDistance(Node node1, Node node2, Graph graph,
		boolean ifPairEdgeAdded) {
	GraphHider graphHider = null;
	if (ifPairEdgeAdded) {
		// hide pair edges and find all sequences
		graphHider = new GraphHider(graph);
		for (Edge edge : graph.getEdgeArray()) {
			DataProvider edgeTypeMap = graph
					.getDataProvider(EdgeMapKeys.EDGE_INFO);
			if (((EdgeInfo) edgeTypeMap.get(edge)).isPair()) {
				graphHider.hide(edge);
			}
		}
	}

	NodeList neighbours = GraphConnectivity.getNeighbors(graph,
			new NodeList(node1),
			ifPairEdgeAdded ? MINIMAL_DISTANCE_PAIRED_NODES
					: MINIMAL_NODES_DISTANCE);

	if (ifPairEdgeAdded) {
		graphHider.unhideAll();
	}

	// if neighbours contains node2 then the distance is less than
	// acceptable
	return !neighbours.contains(node2);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:29,代码来源:SequenceGraphTools.java


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