[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •MST via script-plugin via underlyingGraph
Page 1 of 1

MST via script-plugin via underlyingGraph

Posted: 02 Dec 2014 21:05
by rbelew
i needed a MST in gephi, and it gave me a chance to play with the Gython/script-plugin facility. the general facility seems a fantastic addition to gephi, thanks very much to all involved in this extension.

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)
(this is Kruskal's algorithm, depending on a UnionFind operator, like that provided by David Epstein's PADS library https://www.ics.uci.edu/~eppstein/PADS/UnionFind.py )

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?