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


Java Edge类代码示例

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


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

示例1: findParentWithHighestLevel

import org.graphstream.graph.Edge; //导入依赖的package包/类
/**
 * Determine the parent of a node that has the highest level set.
 * @param node
 * @return parent node that has the highest level assigned
 */
static Node findParentWithHighestLevel(Node node) {
	int inDegreeOfNode = node.getInDegree();
	Node parent = null;

	Iterator<Edge> nodeIterator = node.getEachEnteringEdge().iterator();
	if(inDegreeOfNode == 1)
		parent = nodeIterator.next().getOpposite(node);
	else if (inDegreeOfNode > 1) {
		parent = nodeIterator.next().getOpposite(node);
		while (nodeIterator.hasNext()) {
			Node temp = nodeIterator.next().getOpposite(node);
			if (temp.hasAttribute("layoutLayer") && (int) temp.getAttribute("layoutLayer") > (int) parent.getAttribute("layoutLayer")) {
				parent = temp;
			}
		}

	}

	if(parent != null && !parent.hasAttribute("layouted")) {
		parent.setAttribute("layouted", "true");
		positionNode(parent);
	}
	return parent;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:30,代码来源:HierarchicalLayout.java

示例2: unlabelAdjacentEdges

import org.graphstream.graph.Edge; //导入依赖的package包/类
/**
 * unlabels all edges connected to node which are no longer
 * connected to any other labeled node
 * @param n - the node to apply to adjacent edges
 */
private void unlabelAdjacentEdges(Node n)
{
	for (Edge e : n.getEdgeSet()){
		Node v1 = e.getNode0();
		Node v2 = e.getNode1();

		String ui_label_v1 = v1.getAttribute("ui.label");
		String ui_label_v2 = v2.getAttribute("ui.label");


		if ((ui_label_v1==null || ui_label_v1.equals(""))
				&& (ui_label_v2==null || ui_label_v2.equals("")))
		{
			e.setAttribute("ui.label", "");
		}
	}

}
 
开发者ID:TeamCohen,项目名称:VisualGraph,代码行数:24,代码来源:NodeClickListener.java

示例3: getCuttingEdgesCount

import org.graphstream.graph.Edge; //导入依赖的package包/类
public Integer getCuttingEdgesCount(Graph gr) {
	Integer cuttingEdges = 0;
	Collection<Edge> edges = gr.getEdgeSet();
	
	for (Edge edge : edges) {
		Node n0 = edge.getNode0();
		Node n1 = edge.getNode1();
		if (n0.hasAttribute(GraphPartitionator.PARTITION_ATTRIBUTE) &&
				n1.hasAttribute(GraphPartitionator.PARTITION_ATTRIBUTE)) {
			
			if (!n0.getAttribute(GraphPartitionator.PARTITION_ATTRIBUTE).equals(
					n1.getAttribute(GraphPartitionator.PARTITION_ATTRIBUTE))) {
				cuttingEdges++;
			}
			
		}
	}

	return cuttingEdges;
}
 
开发者ID:isislab-unisa,项目名称:streaminggraphpartitioning,代码行数:21,代码来源:ConcreateQualityChecker.java

示例4: checkSTCproperty

import org.graphstream.graph.Edge; //导入依赖的package包/类
private boolean checkSTCproperty(Node n,List<Node> neighborsOnI) {

		for(Node u:neighborsOnI)
		{
			for(Node v: neighborsOnI)
			{
				Edge e1 = u.getEdgeBetween(v);
				Edge e2 = n.getEdgeBetween(v);
				Edge e3 = n.getEdgeBetween(u);
				if(u!=v && e1==null && ((boolean)e2.getAttribute("stc") && (boolean)e3.getAttribute("stc")))
				{
					return false;
				}
			}
		}
		return true;
	}
 
开发者ID:isislab-unisa,项目名称:streaminggraphpartitioning,代码行数:18,代码来源:AbstractSTCHeuristic.java

示例5: showDependence

import org.graphstream.graph.Edge; //导入依赖的package包/类
public synchronized void showDependence(String from, double fX, double fY,
		String to, double tX, double tY,
		double weight) {
	showNode(from, fX, fY);
	showNode(to, tX, tY);
	int id = uniqId++;

	try {
		Node fromNode = graph.getNode(from);
		if(fromNode == null || !fromNode.hasEdgeToward(to)) {
			Edge edge = graph.addEdge(String.valueOf(id), from, to, true);
			edge.addAttribute("ui.hide");

			final String style =
					String.format("fill-color: rgba(150,150,150,50);size: %spx;",
							Double.isNaN(weight) ? 5 : plateau(weight));
			edge.addAttribute("ui.style", style);
		}
	} catch (IdAlreadyInUseException e) { }
}
 
开发者ID:spideruci,项目名称:cerebro-layout,代码行数:21,代码来源:DynamicDisplay.java

示例6: process

import org.graphstream.graph.Edge; //导入依赖的package包/类
@Override
protected void process() {
    while (graph.getNodeCount() <= getSize()) {
        gen.nextEvents();            
    }
    
    //gerar as partições
    Random rand = new Random();
    Node n1 = graph.getNode(rand.nextInt(graph.getNodeCount()));
    Node n2 = null;
    for (Edge edge : n1.getEachEdge()) {
        n2 = edge.getOpposite(n1);
    }
    
    graph.removeNode(n1);
    graph.removeNode(n2);
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:18,代码来源:FlowerGenerator.java

示例7: removeEvent

import org.graphstream.graph.Edge; //导入依赖的package包/类
public void removeEvent(Event event){
    Node mainNode = graph.getNode(event.mainTerm);
    if(mainNode != null){
        if(mainNode.getAttribute("ui.class").equals("mainTerm")){
            Collection<Edge> edges = mainNode.getEnteringEdgeSet();
            if(edges != null){
                for(Edge edge : edges){
                    if(edge != null){
                        // remove obsolete edge
                        graph.removeEdge(edge);
                        if(edge.getSourceNode().getDegree() == 0){
                            graph.removeNode((Node)edge.getSourceNode());
                        }
                    }
                }
            }
            if(mainNode.getOutDegree() == 0){
                graph.removeNode(mainNode);
            }else{
                mainNode.setAttribute("ui.class", "relatedTerm");
            }
        }
    }
}
 
开发者ID:AdrienGuille,项目名称:MABED,代码行数:25,代码来源:EventGraph.java

示例8: addViewTransition

import org.graphstream.graph.Edge; //导入依赖的package包/类
public void addViewTransition(Command command, io.supermonkey.crawler.device.View oldView, io.supermonkey.crawler.device.View newView) {

		org.graphstream.graph.Node oldNode = getOrCreateNode(oldView);
		org.graphstream.graph.Node newNode = getOrCreateNode(newView);

		oldNode.setAttribute("ui.label", oldView.getId().getShortName());
		newNode.setAttribute("ui.label", newView.getId().getShortName());

		for(Node node : graph.getEachNode()) {
			node.removeAttribute("ui.class");
		}
		newNode.addAttribute("ui.class", "current");

		String edgeLabel = toString(command);
		Edge edge = getOrCreateEdge(toEdgeId(edgeLabel, oldNode, newNode), oldNode, newNode);
		if(edge.isLoop()) {
			edge.addAttribute("ui.class", "loop");
		}
		//edge.setAttribute("ui.label", edgeLabel);
	}
 
开发者ID:enijkamp,项目名称:supermonkey,代码行数:21,代码来源:TraversalViewer.java

示例9: removeEvent

import org.graphstream.graph.Edge; //导入依赖的package包/类
public void removeEvent(MABEDEvent event){
    Node mainNode = graph.getNode(event.mainTerm);
    if(mainNode != null){
        if(mainNode.getAttribute("ui.class").equals("mainTerm")){
            Collection<Edge> edges = mainNode.getEnteringEdgeSet();
            if(edges != null){
                for(Edge edge : edges){
                    if(edge != null){
                        // remove obsolete edge
                        graph.removeEdge(edge);
                        if(edge.getSourceNode().getDegree() == 0){
                            graph.removeNode(edge.getSourceNode().toString());
                        }
                    }
                }
            }
            if(mainNode.getOutDegree() == 0){
                graph.removeNode(mainNode);
            }else{
                mainNode.setAttribute("ui.class", "relatedTerm");
            }
        }
    }
}
 
开发者ID:AdrienGuille,项目名称:SONDY,代码行数:25,代码来源:MABEDEventGraph.java

示例10: toEventList

import org.graphstream.graph.Edge; //导入依赖的package包/类
public MABEDEventList toEventList(){
    MABEDEventList events = new MABEDEventList();
    events.timeSliceLength = AppParameters.dataset.corpus.timeSliceLength;
    events.corpusStart = new Timestamp(AppParameters.dataset.corpus.start.getTime());
    for(Node node : graph){
        if(node.getAttribute("ui.class")!=null && node.getAttribute("ui.class").equals("mainTerm")){
            MABEDEvent event = new MABEDEvent(node.getId(), new MABEDTimeInterval((String) node.getAttribute("I")), (double) node.getAttribute("score"), (ArrayList<Double>) node.getAttribute("anomaly"));
            for(Edge edge : node.getEnteringEdgeSet()){
                event.relatedTerms.add(new MABEDWeightedTerm(edge.getSourceNode().getId(), (double) edge.getAttribute("weight")));
            }
            events.add(event);
        }
    }
    events.sort();
    return events;
}
 
开发者ID:AdrienGuille,项目名称:SONDY,代码行数:17,代码来源:MABEDEventGraph.java

示例11: createGraphEdges

import org.graphstream.graph.Edge; //导入依赖的package包/类
@Override
public void createGraphEdges(VPMGraph vpmGraph, List<VPMAnalyzerResult> analyzerResults) {
    for (VPMAnalyzerResult analyzerResult : analyzerResults) {

        for (VPMEdgeDescriptor edgeDescriptor : analyzerResult.getEdgeDescriptors()) {

            // enrich the merge edge or create a new one
            String sourceNodeId = edgeDescriptor.getSourceNodeID();
            String targetNodeId = edgeDescriptor.getTargetNodeID();
            String edgeId = buildEdgeId(sourceNodeId, targetNodeId);
            Edge mergeEdge = vpmGraph.getEdge(edgeId);
            RelationshipEdge relationShipEdge;
            if (mergeEdge == null) {
                relationShipEdge = (RelationshipEdge) vpmGraph.addEdge(edgeId, sourceNodeId, targetNodeId);
            } else {
                relationShipEdge = (RelationshipEdge) mergeEdge;
            }
            relationShipEdge.addRelationshipLabel(edgeDescriptor.getRelationshipLabel());
            relationShipEdge.addRelationshipInfo(edgeDescriptor.getRelationshipSubLabel());
        }
    }
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:23,代码来源:DefaultVPMAnalyzerService.java

示例12: createControlFlowGraphEdge

import org.graphstream.graph.Edge; //导入依赖的package包/类
/**
 * Creates an edge between two CFG nodes.
 *
 * @param src
 * @param dest
 * @author Shashank B S
 */
private void createControlFlowGraphEdge(VFNode src, VFNode dest) {
	if (graph.getEdge("" + src.getId() + dest.getId()) == null) {
		Edge createdEdge = graph.addEdge(src.getId() + "" + dest.getId(), src.getId() + "", dest.getId() + "", true);
		VFUnit unit = src.getVFUnit();
		createdEdge.addAttribute("ui.label", Optional.fromNullable(unit.getOutSet()).or("").toString());
		createdEdge.addAttribute("edgeData.outSet", Optional.fromNullable(unit.getInSet()).or("").toString());
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:16,代码来源:GraphManager.java

示例13: handleEvent

import org.graphstream.graph.Edge; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void handleEvent(Event event) {
	if (event.getTopic().contentEquals(DataModel.EA_TOPIC_DATA_MODEL_CHANGED)) {
		renderICFG((ICFGStructure) event.getProperty("icfg"));
	}
	if (event.getTopic().contentEquals(DataModel.EA_TOPIC_DATA_SELECTION)) {
		VFMethod selectedMethod = (VFMethod) event.getProperty("selectedMethod");
		boolean panToNode = (boolean) event.getProperty("panToNode");
		try {
			renderMethodCFG(selectedMethod.getControlFlowGraph(), panToNode);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	if (event.getTopic().contentEquals(DataModel.EA_TOPIC_DATA_FILTER_GRAPH)) {
		filterGraphNodes((List<VFNode>) event.getProperty("nodesToFilter"), (boolean) event.getProperty("selection"),
				(boolean) event.getProperty("panToNode"), (String) event.getProperty("uiClassName"));
	}
	if (event.getTopic().equals(DataModel.EA_TOPIC_DATA_UNIT_CHANGED)) {
		VFUnit unit = (VFUnit) event.getProperty("unit");

		for (Edge edge : graph.getEdgeSet()) {
			Node src = edge.getSourceNode();
			VFNode vfNode = src.getAttribute("nodeUnit");
			if (vfNode != null) {
				VFUnit currentUnit = vfNode.getVFUnit();
				if (unit.getFullyQualifiedName().equals(currentUnit.getFullyQualifiedName())) {
					String outset = Optional.fromNullable(unit.getOutSet()).or("").toString();
					edge.setAttribute("ui.label", outset);
					edge.setAttribute("edgeData.outSet", outset);
					src.addAttribute("nodeData.inSet", unit.getInSet());
					src.addAttribute("nodeData.outSet", unit.getOutSet());
				}
			}
		}
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:39,代码来源:GraphManager.java

示例14: getCuttingEdgesCount

import org.graphstream.graph.Edge; //导入依赖的package包/类
public Integer getCuttingEdgesCount(Graph gr) {
	Integer cuttingEdges = 0;
	Collection<Edge> edges = gr.getEdgeSet();
	Stream<Edge> parallelEdges = edges.stream();
	cuttingEdges = (int) parallelEdges.filter(EdgePredicates.isCuttingEdge()).count();
	return cuttingEdges;
}
 
开发者ID:isislab-unisa,项目名称:streaminggraphpartitioning,代码行数:8,代码来源:ParallelQualityChecker.java

示例15: getTotalPartitionedEdges

import org.graphstream.graph.Edge; //导入依赖的package包/类
public Long getTotalPartitionedEdges(Graph gr, SGPHeuristic h) {
	Collection<Edge> edges = gr.getEdgeSet();
	return edges.parallelStream()
			.filter(p -> p.getNode0().hasAttribute(GraphPartitionator.PARTITION_ATTRIBUTE) 
					&& p.getNode1().hasAttribute(GraphPartitionator.PARTITION_ATTRIBUTE))
			.count();
}
 
开发者ID:isislab-unisa,项目名称:streaminggraphpartitioning,代码行数:8,代码来源:ParallelQualityChecker.java


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