• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Graph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkForExpansion

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Checks whether some tables are still expanded.
 * 
 * @param g the graph
 * @param toCheck set of tables to check
 */
private void checkForExpansion(Graph g, java.util.Collection<Table> toCheck) {
	for (Table t: toCheck) {
		if (!expandedTables.contains(t)) {
			addEdges(g, t, null, new ArrayList<Table>(), true);
			boolean isExpanded = true;
			for (Association a: t.associations) {
				if (!isVisualizable(a)) {
					continue;
				}
				if (a.source != t && !tableNodes.containsKey(a.source) && !toCheck.contains(a.source)) {
					isExpanded = false;
					break;
				}
				if (a.destination != t && !tableNodes.containsKey(a.destination) && !toCheck.contains(a.destination)) {
					isExpanded = false;
					break;
				}
			}
			if (isExpanded) {
				expandedTables.add(t);
			}
		}
	}
}
 
开发者ID:P15,项目名称:jailer,代码行数:31,代码来源:GraphicalDataModelView.java


示例2: checkForCollapsed

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Checks whether some tables are still collapsed.
 * 
 * @param g the graph
 * @param toCheck set of tables to check
 */
private void checkForCollapsed(Graph g, java.util.Collection<Table> toCheck) {
	for (Table t: toCheck) {
		if (expandedTables.contains(t)) {
			boolean isExpanded = true;
			for (Association a: t.associations) {
				if (!isVisualizable(a)) {
					continue;
				}
				if (!renderedAssociations.containsKey(a) && !renderedAssociations.containsKey(a.reversalAssociation)) {
					isExpanded = false;
					break;
				}
			}
			if (!isExpanded) {
				expandedTables.remove(t);
			}
		}
	}
}
 
开发者ID:P15,项目名称:jailer,代码行数:26,代码来源:GraphicalDataModelView.java


示例3: transformOWLtoGraph

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Transforms a given OWL Ontology to a graph.
 *
 * @param onto the OWL ontology
 * @param id   the viewManager id
 */
public void transformOWLtoGraph(OWLOntology onto, String id) {
	Graph graph = GraphStorage.getGraph(id);

	if (onto == null || graph == null) {
		return;
	}

	GraphDataModifier mod = GraphStorage.getDataModifier(id);
	Set<OWLClass> OWLClassSet = onto.getClassesInSignature();
	transformClasses(OWLClassSet, onto, mod);
	Set<OWLObjectProperty> OWLObjectPropertiesSet = onto.getObjectPropertiesInSignature();
	transformObjectProperty(OWLObjectPropertiesSet, onto, mod, id);
	Set<OWLDataProperty> OWLDataPropertiesSet = onto.getDataPropertiesInSignature();
	transformDataTypeProperty(OWLDataPropertiesSet, onto, mod, id);
	//	logger.info("# direct imports: " + onto.getDirectImports().toString());
	//	logger.info("# imports: " + onto.getImports().toString());
	//	logger.info("# import declaration: " + onto.getImportsDeclarations().toString());
	transformSubClassesDefinedOutsideOtherClass(OWLClassSet, onto, mod);
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:26,代码来源:TransformOWLtoGraph.java


示例4: run

import prefuse.data.Graph; //导入依赖的package包/类
@Override
public void run( Graph graph )
{
    // add the GRAPH to the visualization
    m_vis.add( GRAPH, graph );

    // hide edges
    Predicate edgesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==false", true );
    m_vis.setVisible( GRAPH_EDGES, edgesPredicate, false );

    m_vis.setInteractive( GRAPH_EDGES, null, false );

    // make node interactive
    m_vis.setInteractive( GRAPH_NODES, null, true );

    // add LABELS to the visualization
    Predicate labelP = (Predicate) ExpressionParser.parse( "VISIBLE()" );
    m_vis.addDecorators( LABELS, GRAPH_NODES, labelP, LABEL_SCHEMA );

    run();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:22,代码来源:StackedGraphDisplay.java


示例5: isMultiLine

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Checks if is multi line.
 * 
 * @param g
 *            the g
 * @return the int
 */
private int isMultiLine(Graph g) {
	int multi = -1;
	Object ori = g.getEdge(g.getEdgeCount() - 1).get("source"); // nodo origen
	Object fin = g.getEdge(g.getEdgeCount() - 1).get("target"); // nodo fin

	for (int i = 0; i < g.getEdgeCount() - 1; i++) {
		if (((Integer) ori).equals((Integer) (g.getEdge(i).get("source")))
				&& ((Integer) fin).equals((Integer) (g.getEdge(i).get("target")))) {
			multi = i;
			return multi;
		}
	}

	return multi;
}
 
开发者ID:santiontanon,项目名称:fterm,代码行数:23,代码来源:FTVisualizerStatic.java


示例6: setGraph

import prefuse.data.Graph; //导入依赖的package包/类
public void setGraph(Graph g, String label) {
    // update labeling
    DefaultRendererFactory drf = (DefaultRendererFactory)
                                            m_vis.getRendererFactory();
    ((LabelRenderer)drf.getDefaultRenderer()).setTextField(label);
    
    // update graph
    m_vis.removeGroup(graph);
    vg = m_vis.addGraph(graph, g);
    m_vis.setValue(edges, null, VisualItem.INTERACTIVE, Boolean.FALSE);
    /*
    VisualItem f = (VisualItem)vg.getNode(0);
    m_vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
    f.setFixed(false);
	*/
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:17,代码来源:GraphView.java


示例7: setGraph

import prefuse.data.Graph; //导入依赖的package包/类
public void setGraph(Graph g, String label) {
    // update labeling
	/*
    DefaultRendererFactory drf = (DefaultRendererFactory)
                                            m_vis.getRendererFactory();
    ((LabelRenderer)drf.getDefaultRenderer()).setTextField(label);
     */
    // update graph
    m_vis.removeGroup(graph);
    vg = m_vis.addGraph(graph, g);
    m_vis.setValue(edges, null, VisualItem.INTERACTIVE, Boolean.FALSE);
    /*
    VisualItem f = (VisualItem)vg.getNode(0);
    m_vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
    f.setFixed(false);
	*/
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:18,代码来源:GraphView2.java


示例8: initDataGroups

import prefuse.data.Graph; //导入依赖的package包/类
private void initDataGroups() {
	// create sample graph
	// 9 nodes broken up into 3 interconnected cliques
	Graph g = new Graph();
	for ( int i=0; i<3; ++i ) {
		Node n1 = g.addNode();
		Node n2 = g.addNode();
		Node n3 = g.addNode();
	}

	// add visual data groups
	VisualGraph vg = m_vis.addGraph(GRAPH, g);
	m_vis.setInteractive(EDGES, null, false);
	m_vis.setValue(NODES, null, VisualItem.SHAPE,
			new Integer(Constants.SHAPE_ELLIPSE));

	AggregateTable at = m_vis.addAggregates(AGGR);
	at.addColumn(VisualItem.POLYGON, float[].class);
	at.addColumn("id", int.class);

}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:22,代码来源:CodyTestWindow.java


示例9: PolarDonutFDRLayout

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Create a new PolarDonutFDRLayout.
 * @param group the data group to layout. Must resolve to a Graph instance.
 * @param enforceBounds indicates whether or not the layout should require
 * that all node placements stay within the layout bounds.
 * @param runonce indicates if the layout will be run in a run-once or
 * animated fashion. In run-once mode, the layout will run for a set number
 * of iterations when invoked. In animation mode, only one iteration of the
 * layout is computed.
 */
public PolarDonutFDRLayout(double circleRadius, String m_group, String filter,
		boolean enforceBounds, boolean runonce){
	super(m_group);

	this.circleRadius = circleRadius;
	this.filter = filter + " and visible()";// and isnode()";
	this.m_filter = (Predicate)ExpressionParser.parse(this.filter);

	m_nodeGroup = PrefuseLib.getGroupName(m_group, Graph.NODES);
	m_edgeGroup = PrefuseLib.getGroupName(m_group, Graph.EDGES);

	m_enforceBounds = enforceBounds;
	m_runonce = runonce;
	m_fsim = new ForceSimulator();
	m_fsim.addForce(new NBodyForce());
	m_fsim.addForce(new SpringForce());
	m_fsim.addForce(new DragForce());
	
	//getForceSimulator().setSpeedLimit(.3f);//XXX: Tweak
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:31,代码来源:PolarDonutFDRLayout.java


示例10: initDataGroups

import prefuse.data.Graph; //导入依赖的package包/类
private void initDataGroups() {
	// create sample graph
	g = new Graph(true);
	for (int i = 0; i < 3; ++i) {
		Node n1 = g.addNode();
		Node n2 = g.addNode();
		Node n3 = g.addNode();
		g.addEdge(n1, n2);
		g.addEdge(n1, n3);
		// g.addEdge(n2, n3);
	}
	g.addEdge(0, 3);
	// g.addEdge(3, 6);
	g.addEdge(6, 0);
	// add labels for nodes and edges
	g.addColumn(VisualItem.LABEL, String.class);
	for (int i = 0; i < 9; i++) {
		g.getNode(i).setString(VisualItem.LABEL, "Node " + i);
	}
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:21,代码来源:GraphEditor.java


示例11: readGraph

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * @see prefuse.data.io.GraphReader#readGraph(java.io.InputStream)
 */
public Graph readGraph(InputStream is) throws DataIOException {
    try {       
        SAXParserFactory factory   = SAXParserFactory.newInstance();
        SAXParser        saxParser = factory.newSAXParser();
        
        GraphMLHandler   handler   = new GraphMLHandler();
        saxParser.parse(is, handler);
        return handler.getGraph();
    } catch ( Exception e ) {
        if ( e instanceof DataIOException ) {
            throw (DataIOException)e;
        } else {
            throw new DataIOException(e);
        }
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:20,代码来源:GraphMLReader.java


示例12: getClique

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Returns a clique of given size. A clique is a graph in which every node
 * is a neighbor of every other node.
 * @param n the number of nodes in the graph
 * @return a clique of size n
 */
public static Graph getClique(int n) {
    Graph g = new Graph();
    g.getNodeTable().addColumns(LABEL_SCHEMA);
    
    Node nodes[] = new Node[n];
    for ( int i = 0; i < n; ++i ) {
        nodes[i] = g.addNode();
        nodes[i].setString(LABEL, String.valueOf(i));
    }
    for ( int i = 0; i < n; ++i ) {
        for ( int j = i; j < n; ++j )
            if ( i != j )
                g.addEdge(nodes[i], nodes[j]);
    }
    return g;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:23,代码来源:GraphLib.java


示例13: getGrid

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Returns a graph structured as an m-by-n grid.
 * @param m the number of rows of the grid
 * @param n the number of columns of the grid
 * @return an m-by-n grid structured graph
 */
public static Graph getGrid(int m, int n) {
    Graph g = new Graph();
    g.getNodeTable().addColumns(LABEL_SCHEMA);
    
    Node[] nodes = new Node[m*n];
    for ( int i = 0; i < m*n; ++i ) {
        nodes[i] = g.addNode();
        nodes[i].setString(LABEL, String.valueOf(i));
        
        if ( i >= n )
            g.addEdge(nodes[i-n], nodes[i]);
        if ( i % n != 0 )
            g.addEdge(nodes[i-1], nodes[i]);
    }
    return g;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:23,代码来源:GraphLib.java


示例14: run

import prefuse.data.Graph; //导入依赖的package包/类
/**
    * @see prefuse.action.Action#run(double)
    */
   public void run(double frac) {
       Graph g = (Graph)m_vis.getGroup(m_group);
       initSchema(g.getNodes());
       
       Arrays.fill(m_depths, 0);
       m_maxDepth = 0;
       
       Point2D a = getLayoutAnchor();
       m_ax = a.getX();
       m_ay = a.getY();
       
       NodeItem root = getLayoutRoot();
       Params rp = getParams(root);

g.getSpanningTree(root);
       
       // do first pass - compute breadth information, collect depth info
       firstWalk(root, 0, 1);
       
       // sum up the depth info
       determineDepths();
       
       // do second pass - assign layout positions
       secondWalk(root, null, -rp.prelim, 0);
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:29,代码来源:NodeLinkTreeLayout.java


示例15: init

import prefuse.data.Graph; //导入依赖的package包/类
private void init(Graph g, Rectangle2D b) {
    initSchema(g.getNodes());
    
    temp = b.getWidth() / 10;
    forceConstant = 0.75 * 
        Math.sqrt(b.getHeight()*b.getWidth()/g.getNodeCount());
    
    // initialize node positions
    Iterator nodeIter = g.nodes();
    Random rand = new Random(42); // get a deterministic layout result
    double scaleW = ALPHA*b.getWidth()/2;
    double scaleH = ALPHA*b.getHeight()/2;
    while ( nodeIter.hasNext() ) {
        NodeItem n = (NodeItem)nodeIter.next();
        Params np = getParams(n);
        np.loc[0] = b.getCenterX() + rand.nextDouble()*scaleW;
        np.loc[1] = b.getCenterY() + rand.nextDouble()*scaleH;
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:20,代码来源:FruchtermanReingoldLayout.java


示例16: setGraph

import prefuse.data.Graph; //导入依赖的package包/类
/**
* Sets visual graph.
* 
* @param g the (non-visual) model graph
*/
  private void setGraph(Graph g) {
      // update graph
  	inInitialization = true;
      visualization.removeGroup(graph);
      visualGraph = visualization.addGraph(graph, g);
      if (visualGraph.getNodeCount() > 1) {
       VisualItem f = (VisualItem) visualGraph.getNode(1);
    visualization.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
       f.setFixed(true);
       ((VisualItem) visualGraph.getNode(0)).setFixed(true);
      }
      
      inInitialization = false;
  }
 
开发者ID:P15,项目名称:jailer,代码行数:20,代码来源:GraphicalDataModelView.java


示例17: showTable

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Creates visible node for given table.
 * 
 * @param graph the graph
 * @param table the table to show
 */
private boolean showTable(Graph graph, Table table) {
	if (table != null && !tableNodes.containsKey(table)) {
		Node n = graph.addNode();
		n.setString("label", table.getName());
		String tooltip = tableRenderer.getToolTip(table);
		n.setString("tooltip", tooltip);
		tableNodes.put(table, n);
		return true;
	}
	return false;
}
 
开发者ID:P15,项目名称:jailer,代码行数:18,代码来源:GraphicalDataModelView.java


示例18: expandTable

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Expands a node representing a table.
 * 
 * @param g the graph
 * @param table the table node
 * @param toRender if not null, the only association to make visible
 *  
 * @return list of newly rendered tables
 */
private List<Table> expandTable(Graph g, net.sf.jailer.datamodel.Table table, Association toRender) {
	List<Table> result = new ArrayList<Table>();
	if (table != null && (!expandedTables.contains(table) || toRender != null)) {
		List<Table> toCheck = new ArrayList<Table>();
		result = addEdges(g, table, toRender, toCheck, false);
		// expandedTables.add(table);
		checkForExpansion(g, toCheck);
	}
	return result;
}
 
开发者ID:P15,项目名称:jailer,代码行数:20,代码来源:GraphicalDataModelView.java


示例19: removeAttributeIsClickedFromAllGraphElements

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * remove the attribute "is clicked" from all nodes and edges
 */
private void removeAttributeIsClickedFromAllGraphElements(Graph graph) {
	for (int i = 0; i < graph.getNodeCount(); i++) {
		Node node = graph.getNode(i);
		node.set(ColumnNames.IS_CLICKED, false);
	}
	for (int i = 0; i < graph.getEdgeCount(); i++) {
		Edge edge = graph.getEdge(i);
		edge.set(ColumnNames.IS_CLICKED, false);
	}
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:14,代码来源:ControlListener.java


示例20: GraphStorage

import prefuse.data.Graph; //导入依赖的package包/类
/**
 * Constructor, without creating a new GraphDataModifier within this class
 */
public GraphStorage(Graph g, String id) {
	if (_graph == null) {
		_graph = new HashMap<String, Graph>();
	}

	if (!_graph.containsKey(id)) {
		_graph.put(id, g);
	}
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:13,代码来源:GraphStorage.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SelectExpressionItem类代码示例发布时间:2022-05-21
下一篇:
Java JdbcOperations类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap