SageMathとグラフ理論(オイラーの公式)

問題

 

車輪グラフW_{8}ついて、オイラーの公式(Euler's formula)が成り立つことを確認せよ。

 

オイラーの公式:

$$ n - m + f = 2 $$

n: 頂点の数、m: 辺の数、f: 面の数

f:id:niming538:20171009133810p:plain

 

 

%hist
G=graphs.WheelGraph(8)
show(G)
len(list(G.vertex_iterator())) # -> 8
len(list(G.edge_iterator())) # -> 14
len(G.faces()) # -> 8
n, m , f = 8, 14, 8
n - m + f == 2 # -> True