本文整理汇总了Java中org.gephi.data.attributes.api.AttributeModel类的典型用法代码示例。如果您正苦于以下问题:Java AttributeModel类的具体用法?Java AttributeModel怎么用?Java AttributeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeModel类属于org.gephi.data.attributes.api包,在下文中一共展示了AttributeModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: calculateClusteringCoefficient
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing calculateClusteringCoefficient() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
ClusteringCoefficient clusteringCoefficient = new ClusteringCoefficient();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating average clustering coefficient...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
clusteringCoefficient.execute(graphModel, am);
double sum = 0.0;
for (Node node : subGraph.getNodes()) {
sum += (double) node.getAttributes().getValue(ClusteringCoefficient.CLUSTERING_COEFF);
}
Double avg = sum / subGraph.getNodeCount();
clusteringCoefficientAverages.add(avg);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:24,代码来源:GephiProcessing.java
示例2: calculateUndirectedDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing calculateUndirectedDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int degreeSum = 0;
for (Node node : subGraph.getNodes()) {
degreeSum += (int) node.getAttributes().getValue(Degree.DEGREE);
}
Double avgDegree = (double) degreeSum / subGraph.getNodeCount();
degreeAverages.add(avgDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:24,代码来源:GephiProcessing.java
示例3: calculateInDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing calculateInDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for In-Degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int inDegreeSum = 0;
for (Node node : subGraph.getNodes()) {
inDegreeSum += (int) node.getAttributes().getValue(Degree.INDEGREE);
}
Double avgInDegree = (double) inDegreeSum / subGraph.getNodeCount();
inDegreeAverages.add(avgInDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:25,代码来源:GephiProcessing.java
示例4: calculateOutDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing calculateOutDegree() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
Degree degree = new Degree();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating averages for Out-degree...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
degree.execute(graphModel, am);
int outDegreeSum = 0;
for (Node node : subGraph.getNodes()) {
outDegreeSum += (int) node.getAttributes().getValue(Degree.OUTDEGREE);
}
Double avgOutDegree = (double) outDegreeSum / subGraph.getNodeCount();
outDegreeAverages.add(avgOutDegree);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, ".. Finised (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:25,代码来源:GephiProcessing.java
示例5: finishedClicked
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* This method handles the action, when "finish" is clicked
*/
public void finishedClicked() {
// check if really wants to finish
int result = JOptionPane.showConfirmDialog(mainFrame, "Do you really want to finish?", "Finishing...", JOptionPane.YES_NO_OPTION);
if(result != JOptionPane.YES_OPTION) {
return;
}
// add columns if not already existing
AttributeModel attrModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
for(int i = 0; i < Constants.newColumnsNode.length; i++) {
if(attrModel.getNodeTable().getColumn(Constants.newColumnsNode[i]) == null) {
attrModel.getNodeTable().addColumn(Constants.newColumnsNode[i], Constants.newColumnsNodeType[i]);
}
}
for(int i = 0; i < Constants.newColumnsEdge.length; i++) {
if(attrModel.getEdgeTable().getColumn(Constants.newColumnsEdge[i]) == null) {
attrModel.getEdgeTable().addColumn(Constants.newColumnsEdge[i], Constants.newColumnsEdgeType[i]);
}
}
// close frame
mainFrame.dispose();
System.exit(0);
}
开发者ID:KSD-research-group,项目名称:plugin4gephi,代码行数:28,代码来源:Controller.java
示例6: partition
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public Partition<Node> partition(Graph<MultimodalItem, SameClassLink> itemsGraph) {
UndirectedGraph graph = getGraph(itemsGraph);
System.out.println("Nodes: " + graph.getNodeCount());
System.out.println("Edges: " + graph.getEdgeCount());
AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
// Run modularity algorithm - community detection
Modularity modularity = new Modularity();
modularity.setUseWeight(true);
modularity.setResolution(1.);
modularity.setRandom(true);
modularity.execute(graphModel, attributeModel);
AttributeColumn modColumn = attributeModel.getNodeTable().getColumn(Modularity.MODULARITY_CLASS);
@SuppressWarnings("unchecked")
Partition<Node> p = partitionController.buildPartition(modColumn, graph);
return p;
}
开发者ID:socialsensor,项目名称:social-event-detection,代码行数:24,代码来源:LouvainClustering.java
示例7: calculateDynamicCentralities
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing calculateDynamicCentralities() {
Stopwatch stopwatch = Stopwatch.createStarted();
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
GraphDistance graphDistance = new GraphDistance();
DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
Log.info(LogCategory.GEXF, "Calculating average centralities...");
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 1;
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
Graph subGraph = dynamicGraph.getSnapshotGraph(i, high);
graphDistance.execute(graphModel, am);
double betweennessSum = 0.0;
double closenessSum = 0.0;
double eccentricitySum = 0.0;
for (Node node : subGraph.getNodes()) {
betweennessSum += (double) node.getAttributes().getValue(GraphDistance.BETWEENNESS);
closenessSum += (double) node.getAttributes().getValue(GraphDistance.CLOSENESS);
eccentricitySum += (double) node.getAttributes().getValue(GraphDistance.ECCENTRICITY);
}
Double averageBetweenness = betweennessSum / subGraph.getNodeCount();
Double averageCloseness = closenessSum / subGraph.getNodeCount();
Double averageEccentricity = eccentricitySum / subGraph.getNodeCount();
betweennessAverages.add(averageBetweenness);
closenessAverages.add(averageCloseness);
eccentricityAverages.add(averageEccentricity);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:33,代码来源:GephiProcessing.java
示例8: getAverageClusteringCoefficient
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* Indicates to which degree nodes in the network tend to cluster together
*/
public static double getAverageClusteringCoefficient(GraphModel graphModel, AttributeModel attributeModel) {
ClusteringCoefficient clusteringCoefficient = new ClusteringCoefficient();
clusteringCoefficient.execute(graphModel, attributeModel);
double sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (double)node.getAttributes().getValue(ClusteringCoefficient.CLUSTERING_COEFF);
}
return sum / graphModel.getGraph().getNodeCount();
}
开发者ID:vizpub,项目名称:vizpub,代码行数:14,代码来源:GephiMetrics.java
示例9: getAverageGraphDistance
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
private static double getAverageGraphDistance(GraphModel graphModel, AttributeModel attributeModel, String distanceType) {
GraphDistance graphDistance = new GraphDistance();
graphDistance.setDirected(true);
graphDistance.setNormalized(true);
graphDistance.execute(graphModel, attributeModel);
double sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (double)node.getAttributes().getValue(distanceType);
}
return sum / graphModel.getGraph().getNodeCount();
}
开发者ID:vizpub,项目名称:vizpub,代码行数:13,代码来源:GephiMetrics.java
示例10: getAverageDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
private static double getAverageDegree(GraphModel graphModel, AttributeModel attributeModel, String degreeType) {
Degree degree = new Degree();
degree.execute(graphModel, attributeModel);
int sum = 0;
for (Node node : graphModel.getGraph().getNodes()) {
sum += (int)node.getAttributes().getValue(degreeType);
}
return sum / graphModel.getGraph().getNodeCount();
}
开发者ID:vizpub,项目名称:vizpub,代码行数:10,代码来源:GephiMetrics.java
示例11: resetPropertiesValues
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
@Override
public void resetPropertiesValues() {
AttributeModel attModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
for (AttributeColumn c : attModel.getNodeTable().getColumns()) {
if(c.getId().equalsIgnoreCase("order")
|| c.getId().equalsIgnoreCase("ord")
|| c.getTitle().equalsIgnoreCase("order")
|| c.getTitle().equalsIgnoreCase("ord")) {
order = c;
} else {
order = null;
}
}
int nodesCount = 0;
if (graphModel != null) {
nodesCount = graphModel.getGraphVisible().getNodeCount();
}
setOrderScale(10.0);
// Tuning
setScalingRatio(1.0);
setStrongGravityMode(false);
setGravity(1.);
setVertical(false);
setCenter(false);
// Performance
if (nodesCount >= 50000) {
setJitterTolerance(10d);
} else if (nodesCount >= 5000) {
setJitterTolerance(1d);
} else {
setJitterTolerance(0.3d);
}
setThreadsCount(2);
}
开发者ID:WouterSpekkink,项目名称:EventGraphLayout_0.8.2,代码行数:45,代码来源:TimeForce.java
示例12: averageControlMsgs
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* Calculates the average number of control messages sent and received.
*
* The averages are calculated by dividing the total number of control messages sent/received
* over the entire execution of the protocol with the number of reporting intervals, i.e. it calculates
* control messages per reporting interval.
*
* @return A pointer to itself for easy client method chaining
*/
public GephiProcessing averageControlMsgs() {
AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
am.getNodeTable().addColumn(NodeAttributes.CONTROL_MSGS_SENT_AVG, AttributeType.DOUBLE);
am.getNodeTable().addColumn(NodeAttributes.CONTROL_MSGS_RECEIVED_AVG, AttributeType.DOUBLE);
for (double i = 0.0; i < reportingIntervalCount; i++) {
double high = i + 0.9;
Integer controlMsgSentCountTotal = 0;
Integer controlMsgRcvdCountTotal = 0;
for (Node node : graphModel.getGraph().getNodes()) {
DynamicInteger gossipsSent = (DynamicInteger) node.getAttributes().getValue(NodeAttributes.CONTROL_MSGS_SENT);
DynamicInteger gossipsReceived = (DynamicInteger) node.getAttributes().getValue(NodeAttributes.CONTROL_MSGS_RECEIVED);
if (gossipsSent == null || gossipsReceived == null) {
Log.debug(LogCategory.COLLECTOR, "Could not find control msg count attributes");
return this;
}
Integer controlMsgSentCount = gossipsSent.getValue(new Interval(i, high));
Integer controlMsgRcvdCount = gossipsReceived.getValue(new Interval(i, high));
// null value means the node was down for this interval due to churn
if (controlMsgRcvdCount != null && controlMsgSentCount != null) {
controlMsgSentCountTotal += controlMsgSentCount;
controlMsgRcvdCountTotal += controlMsgRcvdCount;
}
// double maxInterval = gossipsSent.getHigh();
// Integer gossipSentCount = gossipsSent.getValue(maxInterval - 1, maxInterval);
// Integer gossipReceivedCount = gossipsReceived.getValue(maxInterval - 1, maxInterval);
// Log.debug("node id: " + node.getNodeData().getId());
// Log.debug("gossipSentCount: " + gossipSentCount);
// Log.debug("reportingIntervalCount :" + reportingIntervalCount);
// Log.debug("average: " + gossipSentCount / reportingIntervalCount);
// node.getAttributes().setValue(NodeAttributes.CONTROL_MSGS_SENT_AVG, Math.round(avgGossipsSent * 100.0) / 100.0);
// node.getAttributes().setValue(NodeAttributes.CONTROL_MSGS_RECEIVED_AVG, Math.round(avgGossipsReceieved * 100.0) / 100.0);
}
double avgGossipsSent = (double) controlMsgSentCountTotal / graphModel.getGraph().getNodeCount();
double avgGossipsReceieved = (double) controlMsgRcvdCountTotal / graphModel.getGraph().getNodeCount();
controlMsgsSentAvg.add(avgGossipsSent);
controlMsgsRcvdAvg.add(avgGossipsReceieved);
}
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:60,代码来源:GephiProcessing.java
示例13: averageTopicDiameter
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public GephiProcessing averageTopicDiameter(Set<String> topics) {
Stopwatch stopwatch = Stopwatch.createStarted();
final AttributeModel am = Lookup.getDefault().lookup(AttributeController.class).getModel();
final FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
final DynamicModel dynamicModel = Lookup.getDefault().lookup(DynamicController.class).getModel();
DynamicGraph dynamicGraph = dynamicModel.createDynamicGraph(graphModel.getGraph());
final int topicSize = topics.size();
for (double i = 0.0; i < reportingIntervalCount; i++) {
Log.info(LogCategory.GEXF, "Calculating topic diameter for interval " + i + "...");
double diameter = 0;
double high = i + 1;
Graph graph = dynamicGraph.getSnapshotGraph(i, high);
// Log.debug(LogCategory.GEXF, "Node count: " + graph.getNodeCount());
// Log.debug(LogCategory.GEXF, "Edge count: " + graph.getEdgeCount());
for (String topic : topics) {
AttributeEqualBuilder.EqualStringFilter nodeFilter =
new AttributeEqualBuilder
.EqualStringFilter(am.getNodeTable().getColumn(NodeAttributes.TOPICS));
AttributeEqualBuilder.EqualStringFilter edgeFilter =
new AttributeEqualBuilder
.EqualStringFilter(am.getNodeTable().getColumn(EdgeAttributes.TOPICS));
final String pattern = ".*" + topic + ".*";
nodeFilter.init(graph);
edgeFilter.init(graph);
nodeFilter.setUseRegex(true);
edgeFilter.setUseRegex(true);
nodeFilter.setPattern(pattern);
edgeFilter.setPattern(pattern);
nodeFilter.evaluate(graph, graph);
nodeFilter.finish();
edgeFilter.evaluate(graph, graph);
edgeFilter.finish();
Query nodeQuery = filterController.createQuery(nodeFilter);
Query edgeQuery = filterController.createQuery(edgeFilter);
filterController.setSubQuery(nodeQuery, edgeQuery);
GraphView view = filterController.filter(edgeQuery);
graphModel.setVisibleView(view);
HierarchicalGraph subGraph = graphModel.getHierarchicalGraphVisible();
// Log.debug(LogCategory.GEXF, "Topic graph " + topic + " node count: " + subGraph.getNodeCount());
// Log.debug(LogCategory.GEXF, "Topic graph " + topic + " edge count: " + subGraph.getEdgeCount());
GraphDistance graphDistance = new GraphDistance();
graphDistance.execute(subGraph, am);
diameter += graphDistance.getDiameter();
}
double averageDiameter = diameter / topicSize;
// averageDiameter = (averageDiameter * 100.0) / 100.0;
topicDiameterAverages.add(averageDiameter);
}
long timeElapsed = stopwatch.elapsed(TimeUnit.SECONDS);
Log.info(LogCategory.GEXF, "...Finished! (elapsed time: " + timeElapsed + "s");
return this;
}
开发者ID:vizpub,项目名称:vizpub,代码行数:70,代码来源:GephiProcessing.java
示例14: getAverageInDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public static double getAverageInDegree(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageDegree(graphModel, attributeModel, Degree.INDEGREE);
}
开发者ID:vizpub,项目名称:vizpub,代码行数:4,代码来源:GephiMetrics.java
示例15: getAverageOutDegree
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public static double getAverageOutDegree(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageDegree(graphModel, attributeModel, Degree.OUTDEGREE);
}
开发者ID:vizpub,项目名称:vizpub,代码行数:4,代码来源:GephiMetrics.java
示例16: getAverageBetweenessCentrality
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* Measures how often a node appears on the shortest paths between nodes in the network
*/
public static double getAverageBetweenessCentrality(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageGraphDistance(graphModel, attributeModel, GraphDistance.BETWEENNESS);
}
开发者ID:vizpub,项目名称:vizpub,代码行数:7,代码来源:GephiMetrics.java
示例17: getAverageClosenessCentrality
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* The average distance from a given starting node to all other nodes in the network
*/
public static double getAverageClosenessCentrality(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageGraphDistance(graphModel, attributeModel, GraphDistance.CLOSENESS);
}
开发者ID:vizpub,项目名称:vizpub,代码行数:7,代码来源:GephiMetrics.java
示例18: getAverageEccentricityCentrality
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
/**
* The distance from a given starting node to the farthest node from it in the network
*/
public static double getAverageEccentricityCentrality(GraphModel graphModel, AttributeModel attributeModel) {
return getAverageGraphDistance(graphModel, attributeModel, GraphDistance.ECCENTRICITY);
}
开发者ID:vizpub,项目名称:vizpub,代码行数:7,代码来源:GephiMetrics.java
示例19: getDiameter
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public static double getDiameter(GraphModel graphModel, AttributeModel attributeModel) {
return getGraphDistance(graphModel, attributeModel).getDiameter();
}
开发者ID:vizpub,项目名称:vizpub,代码行数:4,代码来源:GephiMetrics.java
示例20: getAveragePathLength
import org.gephi.data.attributes.api.AttributeModel; //导入依赖的package包/类
public static double getAveragePathLength(GraphModel graphModel, AttributeModel attributeModel) {
return getGraphDistance(graphModel, attributeModel).getPathLength();
}
开发者ID:vizpub,项目名称:vizpub,代码行数:4,代码来源:GephiMetrics.java
注:本文中的org.gephi.data.attributes.api.AttributeModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论