使用python-igraph创建有向图

Geo*_*e L 3 python igraph

我有2个节点类型,其中TypeA将始终指向TypeB,TypeB没有出站边.

如何使用igraph将其指示为有向图?

kli*_*ron 10

http://igraph.org/python/doc/igraph.Graph-class.html# INIT

g = Graph(directed=True)
g.add_vertices(2)
g.add_edges([(0,1)])
g.degree(mode="in")     # -> [0, 1]
g.degree(mode="out")    # -> [1, 0]
Run Code Online (Sandbox Code Playgroud)