but i wound up having to interact with the "underlying" graph because i could not traverse the main graph `g` itself as i'd expected. here's what worked for me:
Code: Select all
subtrees = UnionFind()
Tree = []
nlist = [n for n in g.underlyingGraph.nodes]
sList = []
for u in nlist:
inbr = [e for e in u.getEdgesInTree()]
onbr = [e for e in u.getEdgesOutTree()]
nbrs = inbr + onbr
for e in nbrs:
sList.append( (e.weight,u,e.target) )
sList.sort()
for W,u,v in sList:
if subtrees[u] != subtrees[v]:
Tree.append((u,v))
subtrees.union(u,v)
i was unable to use the `neighbors()` function mentioned in the script-plugin doc https://wiki.gephi.org/index.php/Scripting_Plugin; it generates: "AttributeError: 'org.gephi.graph.dhns.node.AbstractNode' object has no attribute 'neighbors' "
hopes this is of use to others, and i'm curious if others have a cleaner solution?