| Hosted by CoCalc | Download
Kernel: Python 3 (Ubuntu Linux)

Graph Tool in Python 3 (Ubuntu Linux)

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

import graph_tool graph_tool.__version__
'2.24 (commit 9642dd05, Sat Oct 7 23:40:03 2017 +0100)'
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
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)
gtd.graph_draw(g)
Image in a Jupyter notebook
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x7fb86fe1f048, at 0x7fb86fe16ba8>
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)
Image in a Jupyter notebook
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x7fb86fe1f048, at 0x7fb86fe1f710>