本文整理汇总了Java中org.gephi.graph.api.Node.getNodeData方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getNodeData方法的具体用法?Java Node.getNodeData怎么用?Java Node.getNodeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gephi.graph.api.Node
的用法示例。
在下文中一共展示了Node.getNodeData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import org.gephi.graph.api.Node; //导入方法依赖的package包/类
@Override
public void apply(Node n1, Node n2) {
NodeData n1Data = n1.getNodeData();
ForceAtlas2LayoutData n1Layout = n1Data.getLayoutData();
NodeData n2Data = n2.getNodeData();
ForceAtlas2LayoutData n2Layout = n2Data.getLayoutData();
// Get the distance
double xDist = n1Data.x() - n2Data.x();
double yDist = n1Data.y() - n2Data.y();
double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist);
if (distance > 0) {
// NB: factor = force / distance
double factor = coefficient * n1Layout.mass * n2Layout.mass / distance / distance;
n1Layout.dx += xDist * factor;
n1Layout.dy += yDist * factor;
n2Layout.dx -= xDist * factor;
n2Layout.dy -= yDist * factor;
}
}
示例2: apply
import org.gephi.graph.api.Node; //导入方法依赖的package包/类
@Override
public void apply(Node n1, Node n2, double e) {
NodeData n1Data = n1.getNodeData();
ForceAtlas2LayoutData n1Layout = n1Data.getLayoutData();
NodeData n2Data = n2.getNodeData();
ForceAtlas2LayoutData n2Layout = n2Data.getLayoutData();
// Get the distance
double xDist = n1Data.x() - n2Data.x();
double yDist = n1Data.y() - n2Data.y();
double distance = Math.sqrt(xDist * xDist + yDist * yDist) - n1Data.getSize() - n2Data.getSize();
if (distance > 0) {
// NB: factor = force / distance
double factor = -coefficient * e * Math.log(1 + distance) / distance / n1Layout.mass;
n1Layout.dx += xDist * factor;
n1Layout.dy += yDist * factor;
n2Layout.dx -= xDist * factor;
n2Layout.dy -= yDist * factor;
}
}
示例3: applyForce
import org.gephi.graph.api.Node; //导入方法依赖的package包/类
public void applyForce(Node n, RepulsionForce Force, double theta) {
NodeData nData = n.getNodeData();
if (nodes.size() < 2) {
Node regionNode = nodes.get(0);
Force.apply(n, regionNode);
} else {
double distance = Math.sqrt((nData.x() - massCenterX) * (nData.x() - massCenterX) + (nData.y() - massCenterY) * (nData.y() - massCenterY));
if (distance * theta > size) {
Force.apply(n, this);
} else {
for (Region subregion : subregions) {
subregion.applyForce(n, Force, theta);
}
}
}
}
示例4: getLayoutData
import org.gephi.graph.api.Node; //导入方法依赖的package包/类
private DagLayoutData getLayoutData(Node node) {
if (node == null) {
return null;
}
NodeData nodeData = node.getNodeData();
if (nodeData == null) {
return null;
}
return (DagLayoutData) nodeData.getLayoutData();
}