JGraphX図は、そのレゾルバ図換気ネットワークモデル由来処理正しい隣接行列の生成を確認してください。

図JGraphXは、換気ネットワークを生成風のネットワークトポロジを反映するが、エッジノードは正しいもののJGraphはをmxcellが、ラベルは、ノード対応でない場合

側を挿入するときの理由は、方法論的問題に起因し得ます


次のようにそのため、図レゾルバ図1のネットワークが派生するとき、処理されるべきです。

mxgraph.selectVertices();
				Object[] vcells = graphComponent.getGraph().getSelectionCells();
				NodeList nl = new NodeList();
				for (int i = 0; i < vcells.length; i++) {
					mxCell cell = (mxCell) vcells[i];
					Node n = (Node) cell.getValue();
					n.setNodeID(Integer.valueOf(cell.getId()));
					nl.add(n);
				}

				mxgraph.selectEdges();

				Object[] cells = graphComponent.getGraph().getSelectionCells();
				System.out.println("分支数:" + cells.length);
				mxAnalysisGraph aGraph = new mxAnalysisGraph();
				aGraph.setGraph(mxgraph);
				boolean isConnected = mxGraphStructure.isConnected(aGraph);

				if (!isConnected) {

					JOptionPane.showMessageDialog(null, "网络图不是连通图,请检查!", "错误",
							JOptionPane.ERROR_MESSAGE);

				}
				EdgeList el = new EdgeList();
				mxgraph.refresh();
				graphComponent.updateUI();

				for (int i = 0; i < cells.length; i++) {
					mxCell c = (mxCell) cells[i];
					VentEdge ve = (VentEdge) c.getValue();

					if (!ve.isGudingQ()) {
						ve.setAirH(0);
						ve.setAirQ(0);
						ve.setNT(0);
					}

					int outdegree = mxGraphStructure.outdegree(aGraph,
							c.getSource());
					// System.out.println(outdegree+".............");
					
						Node bn = (Node) c.getSource().getValue();
						Node nbn = nl.getNode(bn.getLabel());
						ve.setBnode(nbn);

					
						Node en = (Node) c.getTarget().getValue();
						Node nen = nl.getNode(en.getLabel());
						ve.setEnode(nen);
					

					// if (ve.getLabel() == null || ve.getLabel().equals(""))
					ve.setLabel(ve.getBnode() + "--->" + ve.getEnode());
					System.out.println(ve);
					System.out.println(ve.getBnode() + "--" + ve.getEnode()
							+ "   " + ve.getR() + "   " + ve.getAirH());



公開された34元の記事 ウォンの賞賛9 ビュー90000 +

おすすめ

転載: blog.csdn.net/tianyatest/article/details/47083151