微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Gephi Toolkit - 检索过滤后的节点表

如何解决Gephi Toolkit - 检索过滤后的节点表

我正在使用 Gephi Toolkit (v0.9.2) 以编程方式分析网络。我想排除没有边(零度)的节点,并且我能够成功过滤图形。但是,来自 getNodeTable()org.gephi.graph.api.GraphModel 返回未过滤的节点集(所有节点,甚至那些没有边的节点)。如何检索过滤后的节点表?

为了计算节点列的统计信息(例如中心性和聚类系数度量),我只需要处理可见的节点集(度数 >= 1 的节点)。结果被大量没有边的节点所扭曲。我正在使用 getNumberOrNumberListColumnStatistics() org.gephi.datalab.api.AttributeColumnsController 计算平均值、中值、Q1、Q3、最小值和最大值。

我想找到一种使用 Gephi Toolkit API 使其正常工作的方法,而不是手动计算这些。

//exclude nodes with no edges
FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
DegreeRangeFilter degreeFilter = new DegreeRangeFilter();
degreeFilter.setRange(new Range(1,Integer.MAX_VALUE));
Query query = filterController.createquery(degreeFilter);
GraphView view = filterController.filter(query);
graphModel.setVisibleView(view);
graph = graphModel.getUndirectedGraphVisible();
//Compute mean,median,Q1,Q3,min,and max of clustering coefficients
AttributeColumnsController attributeColumnsController = Lookup.getDefault().lookup(AttributeColumnsController.class);
BigDecimal[] modularityColumnStatistics = attributeColumnsController.getNumberOrNumberListColumnStatistics(graphModel.getNodeTable(),graphModel.getNodeTable().getColumn("clustering"));

double meanClusteringCoefficient = clusteringCoefficientStatistics[0].doubleValue();
double clusteringCoefficientQ1 = clusteringCoefficientStatistics[1].doubleValue();
double medianClusteringCoefficient = clusteringCoefficientStatistics[2].doubleValue();
double clusteringCoefficientQ3 = clusteringCoefficientStatistics[3].doubleValue();
double minClusteringCoefficient = clusteringCoefficientStatistics[6].doubleValue();
double maxClusteringCoefficient = clusteringCoefficientStatistics[7].doubleValue();

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。