Hi,
I'm using graph-tool to try to generate random graphs with a sequence of
degrees. For example, in a 3-node graph, I generated a random graph with all
nodes with input degrees 1 and output degrees 1.
My code:
>>> import graph_tool.all as gt
>>> def deg_sampler():
... return 1,1
...
>>> g = gt.random_graph(3,deg_sampler,parallel_edges=True, self_loops=False)
>>> gt.graph_draw(g)
Can I generate a random graph defining the input and output degrees of each
node? For example, tree nodes with respectively the input degrees (1, 2, 0)
and output degrees (1, 0, 2).
Thanks,
Alvaro
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
Hello,
To find the shortest path and its corresponding distance from a list of
sources to a target in a weight graph, I did:
loop over all sources:
(1) run shortest_path(source, target)
(2) sum up edge weights in elist
Is there a quicker way to do this? Since shortest_path() finds the shortest
path, I thought it should report the shortest distance as well...
Thanks!
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
I've been looking for a while now, and I just can't find how to save a block
state. If it is in the documentation, I apologize for missing it but I don't
think it is.
Basically, What I do is :
open or create a graph, use minimize_blockmodel_dl on it, and then draw it.
Blocks are there and I can query the graph for every node in each state.
After saving the graph, as the blockstate model is not an internal property
(and I can't find a way to make it one) and reloading it, obviously the
block state is gone.
If I do minimize_blockmodel_dl again on the new (but same) graph as before,
I might get different results (this is a stochastic process after all, so
that is expected).
So How can I save the blockstate of the first algorithm, so that I can
reproduce it after saving and reloading a graph (or in a different computer,
or python instance)?
Any and all help is greatly appreciated.
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/