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


Java DirectedSparseMultigraph.getEdges方法代码示例

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


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

示例1: UnosData

import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public UnosData(
    ImmutableSet<UnosExchangeUnit> altruisticDonors,
    ImmutableSet<UnosExchangeUnit> pairs,
    DirectedSparseMultigraph<UnosExchangeUnit, UnosDonorEdge> feasibleTransplants) {
  super();
  this.altruisticDonors = altruisticDonors;
  this.pairs = pairs;
  this.feasibleTransplants = feasibleTransplants;
  ImmutableBiMap.Builder<String, UnosExchangeUnit> nodeIdBuilder = ImmutableBiMap
      .builder();
  for (UnosExchangeUnit alt : altruisticDonors) {
    nodeIdBuilder.put("a" + alt.getDonors().get(0).getId(), alt);
  }
  for (UnosExchangeUnit paired : pairs) {
    nodeIdBuilder.put("p" + paired.getPatient().getId(), paired);
  }
  this.nodeIds = nodeIdBuilder.build();
  ImmutableBiMap.Builder<String, UnosDonorEdge> edgeIdBuilder = ImmutableBiMap
      .builder();
  for (UnosDonorEdge edge : feasibleTransplants.getEdges()) {
    String id = "e" + edge.getDonor().getId() + "-"
        + feasibleTransplants.getDest(edge).getPatient().getId();
    edgeIdBuilder.put(id, edge);
  }
  this.edgeIds = edgeIdBuilder.build();
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:27,代码来源:UnosData.java

示例2: GraphPanel

import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public GraphPanel(DirectedSparseMultigraph<V, E> graph) {
  // this.setLayout(new FlowLayout());
  DirectedSparseMultigraph<V, E> graphTemp = new DirectedSparseMultigraph<V, E>();
  for (V vertex : graph.getVertices()) {
    if (graph.inDegree(vertex) > 0 || graph.outDegree(vertex) > 0) {
      graphTemp.addVertex(vertex);
    }
  }
  for (E edge : graph.getEdges()) {
    if (graphTemp.containsVertex(graph.getSource(edge))
        && graphTemp.containsVertex(graph.getDest(edge))) {
      graphTemp.addEdge(edge, graph.getSource(edge), graph.getDest(edge));
    }
  }
  this.graph = graphTemp;
  layout = new KKLayout<V, E>(this.graph);
  layout.setSize(new Dimension(1000, 800)); // sets the initial size of the
                                            // space
  // The BasicVisualizationServer<V,E> is parameterized by the edge types
  BasicVisualizationServer<V, E> server = new BasicVisualizationServer<V, E>(
      layout);
  server.setPreferredSize(new Dimension(1000, 800));
  this.add(server);

}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:26,代码来源:GraphPanel.java

示例3: inferEdgeArrivalTimes

import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public static <V, E, T extends Comparable<T>> ImmutableMap<E, TimeInstant<T>> inferEdgeArrivalTimes(
    ImmutableMap<V, TimeInstant<T>> nodeArrivalTimes,
    DirectedSparseMultigraph<V, E> feasibleTransplants) {
  ImmutableMap.Builder<E, TimeInstant<T>> edgeArrivalTimes = ImmutableMap
      .builder();
  for (E edge : feasibleTransplants.getEdges()) {
    try {
      TimeInstant<T> sourceTime = nodeArrivalTimes.get(feasibleTransplants
          .getSource(edge));
      TimeInstant<T> destTime = nodeArrivalTimes.get(feasibleTransplants
          .getDest(edge));
      if (sourceTime.compareTo(destTime) <= 0) {
        edgeArrivalTimes.put(edge, destTime);
      } else {
        edgeArrivalTimes.put(edge, sourceTime);
      }
    } catch (RuntimeException e) {
      System.out.println("edge: " + edge);
      System.out.println("source: " + feasibleTransplants.getSource(edge));
      System.out.println("sink: " + feasibleTransplants.getDest(edge));
      System.out.println(nodeArrivalTimes);
      throw e;
    }
  }
  return edgeArrivalTimes.build();
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:27,代码来源:GraphUtil.java

示例4: DirectedEdgeVariables

import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public DirectedEdgeVariables(DirectedSparseMultigraph<V,E> graph, IloCplex cplex) throws IloException{
	super(new HashSet<E>(graph.getEdges()),cplex);
	this.graph = graph;
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:5,代码来源:DirectedEdgeVariables.java

示例5: cohesionGroup

import edu.uci.ics.jung.graph.DirectedSparseMultigraph; //导入方法依赖的package包/类
public String cohesionGroup(ArrayList<String> actors, MultiMap interactions){
	
	DirectedSparseMultigraph<String, String> graph = this.generateGhaph(actors, interactions);
	
	Collection<String> edges = graph.getEdges();
	
	double numArcs = (double)edges.size();
	
	double numActors = (double)actors.size();
	
	double density = (numArcs / (numActors * (numActors - 1)));
	
	Double density1 = new Double(density);
	
	double p = Math.pow(10, 4);  
	
	Double densityFormated = Math.round(density1 * p) / p;
	
	// Save graph
	
	this.saveGraph(graph);
	
	return this.reportCohesion(densityFormated.toString());
	
}
 
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:26,代码来源:SocialInteractionMethods.java


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