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

I am curious what is being used to calculate the standard deviation of the
average in gt.vertex_average and gt.edge_average
>>> t2=gt.Graph()
>>> t2.add_vertex(2)
>>> t2.add_edge(t2.vertex(0), t2.vertex(1))
>>> gt.vertex_average(t2, "in")
(0.5, 0.35355339059327373)
Now, shouldn't std be σ(n)=sqrt(((0-0.5)^2+(1-0.5)^2)/2)=0.5 ?
also q(n-1)=sqrt((0.5^2+0.5^2)/(2-1))~=0.70710
0.3535 is sqrt(2)/4 which happens to be σ(n-1)/2, so it seems there is some
relation to that.
A little bigger graph.
>>> t3=gt.Graph()
>>> t3.add_vertex(5)
>>> t3.add_edge(t3.vertex(0), t3.vertex(1))
>>> gt.vertex_average(t3, "in")
(0.2, 0.17888543819998318)
Now, we should have 0,1,0,0,0 series for vertex incoming degree.
So Windows calc gives σ(n)=0.4 and σ(n-1)~=0.44721, so where does 0.1788854
come from ?
Reason, I am asking because, I have a large graph, where the average looks
quite alright but the std makes no sense, as going by the histogram, degree
values are quite a bit more distributed than the std would indicate.
--
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com…
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.

Maybe someone can help me out with this problem I posted on StackOverFlow:
https://stackoverflow.com/questions/61955566/distance-map-returned-from-sho…
Basically, I discovered that a call to shortest_distance returns a distance
map where certain node entries are missing (I need 349, I only get 328).
Weird thing is that some of the missing nodes are intermediaries for other
nodes that *are* present in the distance map.
The link contains a MWE, which I tested on an older py2 setup, as well as an
up-to-date Docker container. Results are the same.
Would be very grateful for a solution, because I need to be certain about
results correctness before I can proceed with this (very fast!) library.
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hi,
I've been using graph-tool extensively over the past 6 months with
hSBM_topic modeling (https://github.com/martingerlach/hSBM_Topicmodel; from
the Gerlach, Peixoto & Altmann, 2018 paper). I have one small question that
may dramatically improve the usability of this.
The output showing the hierarchical community structure in the word-document
network (chord diagram) is beautiful. However, is there any way to
programmatically identify the blocks (blue squares), so that I can map these
onto the word groups (topics) produced by the hSBM model?
Thanks,
-Tim Hannigan
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

I have a graph in graph-tool with parallel edges. All parallel edges are
assigned an `EdgePropertyMap` representing their weight with a double. I
would like to return a graph where the edges are condensed into a single
edge where a custom reduce operation on these weights is performed. For
example:
H = gt.Graph(directed=True)
H.add_edge(0,1) # edge 0
H.add_edge(0,1) # edge 1
H.add_edge(0,1) # edge 2
H.add_edge(1,0) # edge 3
H.add_edge(0,2) # edge 4
ew = H.new_edge_property("double")
ew[list(H.edges())[0]]=1.2
ew[list(H.edges())[1]]=2.3
ew[list(H.edges())[2]]=-4.2
ew[list(H.edges())[3]]=5.8
ew[list(H.edges())[3]]=1.0
H.ep['weights'] = ew
In this case the edge (0,1), with a reduce function "sum", should have
total weight 1.2+2.3-4.2= -0.7 while the remaining edges should keep the
same weight (i.e. edge 3 should keep weight 5.8 and edge 4 should maintain
weight 1.0).
Using `gt.condensation_graph` seems to do the trick, but only sum operation
can be performed. To do this we need to use `H.vertex_index` as vertex
property:
Hcond, prop, vcount, ecount, v_avg, edge_avg =
gt.condensation_graph(H,prop=H.vertex_index, aeprops=[H.ep['weights']])
Unfortunately this function only allows sum operation to be performed. What
about using a different "reduce" function, like for example max? What about
operations on non-numeric types of edges?
It would greatly help carrying complex operations directly in Graph-tool,
even if the value type of edges property is different than numeric.
More generally, what about introducing a split-apply-reduce framework to
vertices and edges, or is it already possible with some modifications to
`gt.condensation_graph`?

How does minimize_blockmodel_dl deal with multi-graphs (graphs where multiple
edges can exist between two vertices)?
Is the information discarded, or is it incorporated as edge weight, and if
so, how?
Sorry if this is addressed in the documentation.
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hej,
I was wondering if it is possible to install the graph-tool version from a
certain commit. I need maximum cardinality matching with max weight and see
that you implemented this very recently, after the 2.31 version was
launched. I have successfully installed graph-tool through the ubuntu bash
on windows but am not aware of any way to update it to a certain commit.
Is there a way to do this?
Thanks in advance,
Milan
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hi,
I have been using graph-tool in the docker shell in the jupyter notebook,
following the instructions here
<https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#j…>
.
However, after moving to larger networks (not that large; 200,000 vertices)
it seems that the jupyter notework environment doesn't work. I'm not sure
why.
I have instead moved to running it from the terminal. However, things seem
to be a bit different there.
In particular, if I run the following:
import graph_tool as gt
g = gt.load_graph("/Users/samuelgyetvay/Dropbox/jmp/data/clean/j2j",
fmt="graphml")
state = gt.minimize_blockmodel_dl(g, state_args=dict(recs=[g.ep.weight],
rec_types=["discrete-poisson"]))
I get the error message "module 'graph_tool' has no attribute
'minimize_blockmodel_dl'".
I'm not sure what to do.
Thanks
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/