From dulac.adrien at gmail.com Sun Feb 3 03:28:25 2019
From: dulac.adrien at gmail.com (Adrien Dulac)
Date: Sun, 3 Feb 2019 03:28:25 +0100
Subject: [graph-tool] Weighted SBM | weight prediction
In-Reply-To: <396cad8d-1f46-b84e-dac2-e83577703bb8@skewed.de>
References: <622415e3-f77c-e5a4-b1a6-4f65465a3db4@gmail.com>
<396cad8d-1f46-b84e-dac2-e83577703bb8@skewed.de>
Message-ID: <8e91520a-d2de-20f0-36f1-2a4cbf35a59a@gmail.com>
Dear Tiago,
thank you for this suggestion.
I tried but I am not sure of the results that I got, maybe my
computation is wrong ?
I proceeded as follows:
|[...] entropy = state.entropy() e = g.add_edge(x,y) g.ep.weights[e] =
42 new_state = state.copy(g=g, recs=[g.ep.weights],
rec_types=['discrete-poisson']) new_entropy = new_state.entropy() # Here
is the kind of value that I obtain given for the entropy in my working
example # where the graph has N = 167, E = 5787, max weight = 1458, mean
weight = 14 (this is the manufacturing email network from KONECT")
entropy Out[552]: 72938.4714059238 In [553]: new_entropy.entropy()
Out[553]: 109646.67346672397 |
Thus, as far as I understand, to compute the conditional posterior
distribution of the weight I set, we do |np.exp(entropy - new_entropy)|.
But as the difference is big, the exponential is always zero.
I tried with different nodes and weight but always obtain the same kind
of results.
I wonder if there is not an? error in my approach in order to compute
the probability of a missing edge with a given covariate/weight ?
Thanks,
adrien
On 9/26/18 3:21 PM, Tiago de Paula Peixoto wrote:
> Am 26.09.18 um 14:43 schrieb Adrien Dulac:
>> Dear all,
>>
>> I am a bit confused about the use of the weighted network models for a
>> weight prediction task;
>>
>> Suppose we have a weighted network where edges are integers. We fit a SBM
>> with a Poisson kernel as follows:
>>
>> |data = gt.load_graph(...) # The adjacency matrix has integer entries, and
>> weights greater than zero are stored in data.ep.weights. state =
>> gt.inference.minimize_blockmodel(data, B_min=10, B_max=10, state_args=
>> {'recs':[data.ep.weights], 'rec_types' : ["discrete-poisson"]}) |
>>
>> My question, is how can we obtain, from |state|, a point estimate of the
>> Poisson parameters in order to compute the distribution of the weights
>> between pairs of nodes.
> It's not this simple, since the model is microcanonical and contains
> hyperpriors, etc. The easiest thing you can do is compute the conditional
> posterior distribution of an edge and its weight. You get this by adding the
> missing edge with the desired weight to the graph, and computing the
> difference in the state.entropy(), which gives the (un-normalized) negative
> log probability (remember you have to copy the state with
> state.copy(g=g_new), after modifying the graph). By normalizing this over
> all weight values, you have the conditional posterior distribution of the
> weight.
>
> (This could be done faster by using BlockState.get_edges_prob(), but that
> does not support edge covariates yet.)
>
> Best,
> Tiago
>
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From weitaohan.cn at gmail.com Thu Feb 28 07:45:18 2019
From: weitaohan.cn at gmail.com (Weitao Han)
Date: Thu, 28 Feb 2019 14:45:18 +0800
Subject: [graph-tool] Fwd: Generate scale-free networks with desired
power-law degree distributions
In-Reply-To:
References:
Message-ID:
I'm trying to reproduce the synthetic networks (graphs) described in some
papers.
How to create scale-free networks with desired power-law degree
distributions, ? The lambda ? values are given, like:
1. n = 50000, ? = 3, 2.7, 2.3, with in a paper
2. n = 4000 and ? = 2.5, or n = 6000 and ? = 3 in the other paper
Here are some references:
1. Catastrophic cascade of failures in interdependent networks, Buldyrev et
al. 2010, with a separately provided Supplementary Information
2. Small Cluster in Cyber Physical Systems, Huang et al. 2014
3. Catastrophic cascade of failures in interdependent networks, Havlin et
al. 2010, this is on the Arxiv and somewhat clarifies the first
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From rk5devmail at gmail.com Mon Feb 11 23:04:22 2019
From: rk5devmail at gmail.com (Rich5)
Date: Mon, 11 Feb 2019 22:04:22 -0000
Subject: [graph-tool] Graphviz only showing single edge to node even with
multiple edges
Message-ID: <1549922660766-0.post@n3.nabble.com>
I'm having trouble with getting graphviz_draw to display the same edges as
graph_draw. graph_draw displays the correct number of edges. (Please ignore
the color differences. I'm not concerned with that just now)
Using the same graph the following calls generate graphs with different
topologies:
graph_draw(g, vertex_text=g.vp.label, output_size=(500,500))
graphviz_draw(g,
#vsize=.00001,
size=(1000,1000),
ratio="auto",
layout="dot",
splines=True,
penwidth=1,
vcolor=g.vp.x_in,
ecolor=g.ep.score,
vprops={"label": g.vp.label},
vcmap=cm.OrRd,
ecmap=cm.OrRd,
eprops={
"arrowhead": "normal",
"arrowsize" : 2.0,
},
gprops={"label" : g.gp.x_in,
},
overlap="prism",
output='network.png')
All filters have been cleared prior to calling these functions. Any ideas
what I'm doing wrong? I'm fairly new to using graph-tool and graphviz.
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
From serg.naumenko at alum.utoronto.ca Tue Feb 26 03:12:14 2019
From: serg.naumenko at alum.utoronto.ca (sergzz)
Date: Mon, 25 Feb 2019 19:12:14 -0700 (MST)
Subject: [graph-tool] Computing K number of shortest paths for a single
end-node
Message-ID: <1551147134371-0.post@n3.nabble.com>
Hello,
I have just discovered graph-tool and read through a bunch of documentation.
I am fairly new to python and graphs. The speed comparison to networkx
really impressed me!
I was utilizing networkx for a project to find K number of weighted shortest
paths from a source to a target node.
It has 'all_simple_path' function - outputting a generator that generates
all paths starting from shortest to longest. I would simply cut the
generator to the K number of paths that I needed.
I can't find a similar function in graph-tool, but I am sure this could be
implemented. The only thing I found was the all_shortest_paths function, but
that only returns the shortest path(s), in most cases only 1. Could you
point me in the right direction how to efficiently generate and store K
number of shortest paths for a specified node?
I know I could just generate all paths and then cut down based on order, but
that's not a real solution since I am running into memory issues with a
small amount of nodes.
Thanks!
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
From weitaohan.cn at gmail.com Thu Feb 28 04:41:00 2019
From: weitaohan.cn at gmail.com (halexan)
Date: Wed, 27 Feb 2019 20:41:00 -0700 (MST)
Subject: [graph-tool] Generate scale-free networks with desired power-law
degree distributions
Message-ID: <1551325260326-0.post@n3.nabble.com>
I'm trying to reproduce the synthetic networks (graphs) described in some
papers.
How to create scale-free networks with a desired power-law degree
distributions,
? The lambda ? values are given, like:
1. n = 50000, ? = 3, 2.7, 2.3, with in a paper
2. n = 4000 and ? = 2.5, or n = 6000 and ? = 3 in the other paper
Here are some references:
1. Catastrophic cascade of failures in interdependent networks, Buldyrev et
al. 2010, with a separately provided Supplementary Information
2. Small Cluster in Cyber Physical Systems, Huang et al. 2014
3. Catastrophic cascade of failures in interdependent networks, Havlin et
al. 2010, this is on the Arxiv and somewhat clarifies the first
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
From tanguy.fardet at tuebingen.mpg.de Thu Feb 28 11:24:52 2019
From: tanguy.fardet at tuebingen.mpg.de (Tanguy Fardet)
Date: Thu, 28 Feb 2019 11:24:52 +0100
Subject: [graph-tool] Fwd: Generate scale-free networks with desired
power-law degree distributions
In-Reply-To:
References:
Message-ID: <67114a4e-d11c-33b8-3f14-97e2f1088c2b@tuebingen.mpg.de>
Hi Weitao Han
In general I think you would want to use a generative model (see for
instance
http://tuvalu.santafe.edu/~aaronc/courses/5352/fall2013/csci5352_2013_L11.pdf
for an introduction).
You can find an implementation that is already ready in my library,
(primarily for directed networks):
https://nngt.readthedocs.io/en/latest/modules/generation.html#nngt.generation.random_scale_free
Best,
Tanguy
Le 28/02/2019 ? 07:45, Weitao Han a ?crit?:
>
> I'm trying to reproduce the synthetic networks (graphs) described in
> some papers.
>
> How to create scale-free networks with desired power-law degree
> distributions, ? The lambda ? values are given, like:
>
> 1. n = 50000, ? = 3, 2.7, 2.3, with in a paper
> 2. n = 4000 and ? = 2.5, or n = 6000 and ? = 3 in the other paper
>
> Here are some references:
>
> 1. Catastrophic cascade of failures in interdependent networks,
> Buldyrev et al. 2010, with a separately provided Supplementary
> Information
> 2. Small Cluster in Cyber Physical Systems, Huang et al. 2014
> 3. Catastrophic cascade of failures in interdependent networks, Havlin
> et al. 2010, this is on the Arxiv and somewhat clarifies the first
-------------- next part --------------
An HTML attachment was scrubbed...
URL: