CoCalc Public Filesgraph-tool.ipynbOpen with one click!
Author: Harald Schilly
Views : 290
Compute Environment: Ubuntu 18.04 (Deprecated)

Graph Tool in Python 3 (Ubuntu Linux)

https://graph-tool.skewed.de/

In [1]:
import graph_tool graph_tool.__version__
'2.24 (commit 9642dd05, Sat Oct 7 23:40:03 2017 +0100)'
In [2]:
import graph_tool as gt import graph_tool.collection as gtcol import graph_tool.centrality as gtc import graph_tool.topology as gtt import graph_tool.draw as gtd import numpy as np import matplotlib
In [3]:
g = gtcol.data["polblogs"] g = gt.GraphView(g, vfilt=gtt.label_largest_component(g)) w = g.new_edge_property("double") w.a = np.random.random(len(w.a)) * 42 t = gtc.eigentrust(g, w)
In [4]:
gtd.graph_draw(g)
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x7fb86fe1f048, at 0x7fb86fe16ba8>
In [5]:
gtd.graph_draw(g, pos=g.vp["pos"], vertex_fill_color=t, vertex_size=gtd.prop_to_size(t, mi=5, ma=15), vcmap=matplotlib.cm.gist_heat, vorder=t)
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x7fb86fe1f048, at 0x7fb86fe1f710>
In [ ]: