From aae437a3a1b53248192401ecc1a5a4ce1c7bd4bc Mon Sep 17 00:00:00 2001 From: qian Date: Fri, 16 Sep 2016 16:05:07 -0400 Subject: [PATCH] fixed discovRe errors --- raw-feature-extractor/graph_property.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 raw-feature-extractor/graph_property.py diff --git a/raw-feature-extractor/graph_property.py b/raw-feature-extractor/graph_property.py new file mode 100644 index 0000000..4319292 --- /dev/null +++ b/raw-feature-extractor/graph_property.py @@ -0,0 +1,24 @@ +import networkx as nx +import pdb +def betweeness(g): + #pdb.set_trace() + betweenness = nx.betweenness_centrality(g) + return betweenness + +def eigenvector(g): + centrality = nx.eigenvector_centrality(g) + return centrality + +def closeness_centrality(g): + closeness = nx.closeness_centrality(g) + return closeness + +def retrieveGP(g): + bf = betweeness(g) + #close = closeness_centrality(g) + #bf_sim = + #close_sim = + x = sorted(bf.values()) + value = sum(x)/len(x) + return round(value,5) +