Question about how to deal with weighted networks in SBM

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about how to deal with weighted networks in SBM

Henrique Ferraz de Arruda
Dear all,
I have been using the lasted version of graph-tools, compiled from master and I'm not having much success with using weighted networks on the method "minimize_nested_blockmodel_dl"

I'm passing the weights as the "recs" argument. The code executes the entire task, but when I visualize the communities doesn't seem to be correctly assigned. I would appreciate if someone could, please, show an example of use, or take a look at my code, as follow:

...

gtGraph = gt.Graph(directed=True)
gtGraph.add_edge_list(edges)

#load the weight
prop = gtGraph.new_edge_property("double")

for i,e in enumerate(edges):
    prop[gtGraph.edge(e[0],e[1])] = w[i]

state = gt.minimize_nested_blockmodel_dl(gtGraph, state_args={"recs":[prop], "rec_types":['real-normal']})

...


Tank you.

Best regards.

Henrique.

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Question about how to deal with weighted networks in SBM

Tiago Peixoto
Administrator
On 16.10.2017 07:54, Henrique Ferraz de Arruda wrote:

> Dear all,
> I have been using the lasted version of graph-tools, compiled from master
> and I'm not having much success with using weighted networks on the method
> "minimize_nested_blockmodel_dl"
>
> I'm passing the weights as the "recs" argument. The code executes the entire
> task, but when I visualize the communities doesn't seem to be correctly
> assigned. I would appreciate if someone could, please, show an example of
> use, or take a look at my code, as follow:
>
> ...
>
> gtGraph = gt.Graph(directed=True)
> gtGraph.add_edge_list(edges)
>
> #load the weight
> prop = gtGraph.new_edge_property("double")
>
> for i,e in enumerate(edges):
>     prop[gtGraph.edge(e[0],e[1])] = w[i]
>
> state = gt.minimize_nested_blockmodel_dl(gtGraph, state_args={"recs":[prop],
> "rec_types":['real-normal']})
>
> ...
I don't see anything wrong with the above. If you want a complete example of
use, look at the documentation:

https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#edge-weights-and-covariates

It is difficult to say anything more concrete without a complete and
self-contained example, and an explanation of what you mean by communities
not being "correctly assigned".

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>