Dear Tiago,
I have a directed graph of about half a million nodes and approximately a
million edges following scale free behaviour and a power law degree
distribution. To test some of my hypothesis, I would like to generate random
smaller graphs (about 50 up to 200 nodes) representative of the big one.
When I used a sample function that samples straight away from the real
distribution of the big network, I have following problems:
- I generate unconnected nodes with both 0 in AND out degree.
- I generate small sub parts of a few nodes that are not connected to the
main graph.
- If only sampling from nodes with at least 1 degree, the generated graph is
coherent, but not representative anymore as I need a big portion of nodes
with either only one in or one out degree.
Here is the part of my script I used for that, where samples are drawn from
dictionaries of the degrees:
def sample_in():
a=np.random.randint(num)
k_in = in_degrees[a]
return k_in
def sample_out():
if sample_in()==0:
b=np.random.randint(num_out)
k_out=out_zero_zeros.values()[b]
return k_out
else:
b=np.random.randint(num)
k_out=out_degrees[b]
return k_out
N=200
g=gt.random_graph(N, lambda:(sample_in(), sample_out()),
model="constrained-configuration", directed=True)
I also tried sampling from a list of tuples as you have mentioned before in
the forum, but I didn't receive any results, as the tuples randomly drawn
from my list might not be combinable.
degs=[(7,1),(4,3),(5,6),(2,4),(6,8),(2,0),(3,5),(0,3),(2,7),(2,1)]
g = gt.random_graph(4, lambda i: degs[i], directed=True)
- Is there any option I could active that would help me in those cases I
described above?
- Is there a better way how to create representative small networks?
Any help on that issue will be much appreciated.
Best wishes,
Jana
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hi again,
I'm writing a small package that builds on graph-tool, but not on its graphics capabilities (also because I have to represent other things rather than the graph itself). Still I could use some of the functions "under the hood" for my purposes. I have a question about gt.draw.get_hierarchy_control_points(): the function returns the Bézier spline control points for edges in a given graph, but I'm having difficulties in understanding how this information is encoded. For a single edge in graph, I have dozens of values as control points (half dozens + 2), hence I suspect all splines going from node A to the root of a hierarchy and back to node B are encoded there, and control points should be taken 6 by 6 (3x2 by 3x2 coordinates?). How (x,y) for control points are encoded then: (x, x, x, y, y, y) or (x, y, x, y, x, y)? What are the 2 additiona values I have for each vector? Also, are values absolute or relative to one node in particular (A, B or root...)?
Thanks
d

Hi all,
I´d have a question regarding model selection with different distributions.
When we want to decide the partition that best describes the data for a
given distribution we go with that that gives the smallest entropy. However
say we want to compare 2 different distributions d1 and d2 and the best fit
for d1 gives an entropy value of e1 and for d2 e2 respectively. If e1 < e2,
can we say that d1 describes better our data than d2?
Best Regards,
Enrique Castaneda
--
Sent from: https://nabble.skewed.de/

hi,
i think i understand the difference between the overlapping SBM and
mixed-membership SBM (introduced by Airoldi et al, 2009).
in MMSBM, a given node can be in multiple blocks, their membership is
discrete (0-1)
in overlapping SBM, a given node can also be a member of multiple blocks,
but it with some probability (i.e., node v is in block B1 with probability
1/2, block B2 with probability 2/3, and all other blocks with probability
0).
is there any way to implement MMSBM in graph-tool?
also, slightly unrelated, is there any way to fit a hierarchical model with
2 levels where the top level is overlapping and the bottom level is not?
cheers,
-sam
--
Sent from: https://nabble.skewed.de/

Hi, I came across this library looking for an efficiently implemented graph
library and it looks awesome. One of the tasks I'd like to perform is
efficient edge contraction, where I remove an edge from the graph and merge
the two nodes joined by that edge, and then merge all the incident edges to
those nodes.
I'd like to do this "dynamically", where I may iterate through a list of
edges and selectively collapse some of them (skipping ones which have
already been merged).
Any suggestions on how to perform this with graph-tools?
--
Sent from: https://nabble.skewed.de/

Hi all,
I've been trying to learn more about the Bayesian inference techniques
introduced in
https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.123.128301 and have
been having much joy trying the graph-tool software - it is a fantastic
tool. I have been having difficulty understanding how one would estimate
both the posterior distribution of a graph and the corresponding
transmission probabilities in the SI dynamics example as suggested in the
Twitter example of the aforementioned paper. For example taking the example
from the cookbook (which is very clear) regarding these ideas but now
assigning a edge property for the transmission probabilities (although
leaving them homogeneous across all edges)
#####################################
### Look at using an edge based beta value
# We will first simulate the dynamics with a given network
g = gt.collection.data["dolphins"]
tau = g.new_ep("double", .7) # transmission probabilities
### simulate the dynamics
ss = []
for i in range(100):
si_state = gt.SIState(g, beta=tau)
s = [si_state.get_state().copy()]
for j in range(10):
si_state.iterate_sync()
s.append(si_state.get_state().copy())
# Each time series should be represented as a single vector-valued
# vertex property map with the states for each node at each time.
s = gt.group_vector_property(s)
ss.append(s)
####################################
and now considering the inference part my confusion is arising from how to
assign a prior transmission value as a edge property when we are
initializing the graph as empty. So below I am just changing the function
collect_marginals as I want the local transmission probs (accessed through
get_x() ) rather than the global beta as before and also not using a global
beta in the block state. I assume here that if we were only interested in
the transmisison probs i.e., not the graph posterior, then we'd assign an
edge property to the graph but if we assume that we also don't know the
edges I don't see how to assign the prior distribution. (I don't think beta
= .7 is setting the prior to 0.7 beforehand but I may be mistaken here?)
####################################
# Prepare the initial state of the reconstruction as an empty graph
u = g.copy()
u.clear_edges()
ss = [u.own_property(s) for s in ss] # time series properties need to be
'owned' by graph u
def collect_marginals(s):
global gm, bs
gm = s.collect_marginal(gm)
bs.append(s.bstate.b.a.copy())
betas.append(s.get_x().copy())
# Create reconstruction state
# but don't use a global beta and also don't state the no. of edges
# note the prior beta is the same as the true one?
rstate = gt.EpidemicsBlockState(u, s=ss, beta=.7, r=1e-6,
nested=False)
# Now we collect the marginals for exactly 100,000 sweeps, at
# intervals of 10 sweeps:
gm = None
bs = []
betas = []
gt.mcmc_equilibrate(rstate, force_niter=10000, mcmc_args=dict(niter=10,
xstep=0),
callback=collect_marginals)
##################################
but when I access the arrays within betas after they all just consist of 0
values (through betas[i].get_array()) which makes me think I am not doing
this process correctly (the graph similarities with the posterior and actual
are also negligible~0.05).
Any help with this problem (I may be doing something very incorrect in the
process) and how to correctly implement an edge prior without knowledge of
the graph would be greatly appreciated as I would like to delve further into
these techniques.
--
Sent from: https://nabble.skewed.de/

Hello,
After updating graph_tool from version 2.33 to 2.35, I cannot make plots
with graphviz_draw() anymore. Here is a minimal example to reproduce the
error:
#################################
import graph_tool.all as gt
g = gt.Graph()
v0 = g.add_vertex()
v1 = g.add_vertex()
e01 = g.add_edge(v0,v1)
g_dict = {'layout':'neato'}
gt.graphviz_draw(g, gprops=g_dict)
#################################
The error message is:
#################################
Error: Layout type: "n" not recognized. Use one of: circo dot fdp neato
nop nop1 nop2 osage patchwork sfdp twopi
Error: Layout was not done
Segmentation fault
#################################
I suspect that somewhere the string 'neato' is converted to a single
character 'n'. In my real code, I also get several warning messages
quoting only the first character of miscellaneous strings.
I have python3-graph-tool installed on my computer which runs on Linux
Mint 19.2 Tina (based on Ubuntu 18.04 LTS, bionic). My graphviz version
is 2.40.1.
Can anyone reproduce this?
Best regards
Rolf
--
-----------------------------------------------------------------------
Rolf Sander phone: [+49] 6131/305-4610
Max-Planck Institute of Chemistry email: rolf.sander(a)mpic.de
PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
-----------------------------------------------------------------------
https://www.encyclopedia-of-geosciences.nethttps://www.geoscientific-model-development.net
-----------------------------------------------------------------------

Hi, I am writing you because I experience problems with installing graph-tool
I do what was said in
https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#d…
I get following error:
-------------------------------------------------------------------------------------------------------------------
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-graph-tool : Depends: libboost-regex1.71.0-icu67 but it is not
installable
Recommends: libgv-python but it is not installable
Recommends: python-matplotlib but it is not
installable
Recommends: python-cairo but it is not going to be
installed
Recommends: python-gi-cairo but it is not going to be
installed
Recommends: python-gi but it is not going to be
installed
E: Unable to correct problems, you have held broken packages.
-------------------------------------------------------------------------------------------------
I added the following line to sources.list
deb https://downloads.skewed.de/apt bullseye main
Can you help with this? I use ubuntu within Windows
--
Sent from: https://nabble.skewed.de/