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


Java SubstrateNetwork.getVertexCount方法代码示例

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


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

示例1: estimate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public double estimate(SubstrateNetwork sNetwork, VirtualNetwork vNetwork) {
	
	if (sNetwork.getVertexCount() < vNetwork.getVertexCount())
		return 0;
	
	double cpu = estimateCPU(sNetwork.getVertices(), vNetwork.getVertices());
	double bandwidth = estimateBandwith(sNetwork.getEdges(), vNetwork.getEdges());
	
	if (cpu < 1 || bandwidth < 1)
		return 0;
	
	double result = (cpu * bandwidth);

	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:17,代码来源:CpuBandwidthNetworkEstimation.java

示例2: findAllPartitions

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static LinkedList<Partition> findAllPartitions(SubstrateNetwork cluster, SubstrateNetwork wholeNetwork) {
	
	LinkedList<Partition> result = new LinkedList<Partition>();
	Collection<SubstrateNode> remainingNodes = cluster.getVertices();
	
	int seenNodes = 0;
	for (Iterator<SubstrateNode> nodeset = remainingNodes.iterator(); nodeset.hasNext(); nodeset = remainingNodes.iterator()) {
		SubstrateNetwork currentCluster = dfs(cluster, nodeset.next());
		result.add(new Partition(currentCluster));
		
		Collection<SubstrateNode> currentClusterNodes = currentCluster.getVertices();
		seenNodes += currentClusterNodes.size();
		if (seenNodes == cluster.getVertexCount()) {
			break;
		}
		
		remainingNodes = vnreal.algorithms.utils.SubgraphBasicVN.Utils.minus(remainingNodes, currentClusterNodes);
	}
	
	if (wholeNetwork != null) {
		for (Partition s1 : result) {

			for (Partition s2 : result) {

				for (SubstrateNode n1 : s1.getSubstrateNetwork().getVertices()) {
					for (SubstrateNode n2 : s2.getSubstrateNetwork().getVertices()) {
						Collection<SubstrateLink> edges = wholeNetwork.findEdgeSet(n1, n2);
						if (edges != null && !edges.isEmpty()) {
							for (SubstrateLink e : edges) {
								if (wholeNetwork.getEndpoints(e).getFirst() == n1) {
									s1.getDirectedEdgesToNeighbors().add(new PartitionConnection(n1.getName(), s1, n2.getName(), s2, e));
								} else {
									s2.getDirectedEdgesToNeighbors().add(new PartitionConnection(n2.getName(), s2, n1.getName(), s1, e));
								}

							}
						}
					}
				}

			}
		}
	}
	
	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:47,代码来源:PartitioningUtils.java

示例3: getPartitionsTree

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
	 * Creates whole Locktree below root
	 * @param parent Parent Tree
	 * @param level Level of Tree
	 * @param delegationNodes the DelegationNodes
	 * @param parentCluster SubstratNetwork of Parent
	 */
	private int getPartitionsTree(LockTree parent, int level, Collection<ClusterHead> delegationNodes,
			SubstrateNetwork parentCluster, int depth) {
		int maxdepth = depth;
		if (parentCluster.getVertexCount() < minPartitionSize) {
			return maxdepth;
		}
		
		Collection<Partition> partitions = partitioningAlgorithm.getPartitions(parentCluster);
		if (partitions != null && partitions.size() > 1) {
			LinkedList<LockTree> children = new LinkedList<LockTree>();
			for (Partition partition : partitions) {
				
				SubstrateNetwork partitionNet = partition.getSubstrateNetwork();
				SubstrateNode clusterhead = Utils.findClusterhead(partitionNet);
				
				ClusterHead clusterHead = null;
				
				if (fullKnowledgeNodesLevel <= level) {
					clusterHead = new FullKnowledgeClusterHead(
							partitionNet,
							false,
							level,
							(delegationNodesLevel == level),
							clusterhead,
							(delegationNodesLevel <= level ? null : delegationNodes),
							embeddingAlgorithmFactory.createInstance(),
							estimationAlgorithm);
					
					//we only need to add Information if the parent is PK
//					if(parent.getClusterHead() instanceof PartialKnowledgeClusterHead) {
//						PartialKnowledgeClusterHead pkn = (PartialKnowledgeClusterHead) parent.getClusterHead();
//						pkn.addChildInfo(clusterHead, new NetworkInformation(partitionNet.getCopy(false, true), partition.getDirectedEdgesToNeighbors()));
//					}
//				} else {
//					clusterHead = new PartialKnowledgeClusterHead(
//							partitionNet.getCopy(false, true),
//							(delegationNodesLevel == level),
//							level,
//							clusterhead,
//							(delegationNodesLevel <= level ? null : delegationNodes),
//							estimationAlgorithm,
//							partitioningAlgorithm,
//							partialLinkmappingAlgorithm,
//							embeddingAlgorithmFactory.createInstance(),
//							partition.getDirectedEdgesToNeighbors());
//					
//					//If we have a PKNode we simply add our the info to the Parent (has to be a PK Node to)
//					((PartialKnowledgeClusterHead)parent.getClusterHead()).addChildInfo(clusterHead, ((PartialKnowledgeClusterHead)clusterHead).getNetInfo().getCopy());
				}
				
				LockTree child = new LockTree("p" + (pCounter++), parent, clusterHead);
				
				if (delegationNodesLevel == level) {
					delegationNodes.add(clusterHead);
				}
				
				// in reality, the next step would be done by "clusterhead".
				if (maxLevel == -1 || level < maxLevel) {
					int d = getPartitionsTree(child, level+1, delegationNodes, partition.getSubstrateNetwork(), depth+1);
					if (d > maxdepth) {
						maxdepth = d;
					}
				}
				
				children.add(child);
			}
			parent.setChildren(children);
		}
		
		return maxdepth;
	}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:79,代码来源:HierarchicalPartitioning.java


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