本文整理汇总了Python中sage.graphs.all.DiGraph.plot方法的典型用法代码示例。如果您正苦于以下问题:Python DiGraph.plot方法的具体用法?Python DiGraph.plot怎么用?Python DiGraph.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.graphs.all.DiGraph
的用法示例。
在下文中一共展示了DiGraph.plot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot
# 需要导入模块: from sage.graphs.all import DiGraph [as 别名]
# 或者: from sage.graphs.all.DiGraph import plot [as 别名]
def plot(self, label_elements=True, element_labels=None,
label_font_size=12,label_font_color='black', layout = "acyclic", **kwds):
"""
Returns a Graphics object corresponding to the Hasse diagram.
EXAMPLES::
sage: uc = [[2,3], [], [1], [1], [1], [3,4]]
sage: elm_lbls = Permutations(3).list()
sage: P = Poset(uc,elm_lbls)
sage: H = P._hasse_diagram
sage: levels = H.level_sets()
sage: heights = dict([[i, levels[i]] for i in range(len(levels))])
sage: type(H.plot(label_elements=True))
<class 'sage.plot.graphics.Graphics'>
::
sage: P = Posets.SymmetricGroupBruhatIntervalPoset([0,1,2,3], [2,3,0,1])
sage: P._hasse_diagram.plot()
"""
# Set element_labels to default to the vertex set.
if element_labels is None:
element_labels = range(self.num_verts())
# Create the underlying graph.
graph = DiGraph(self)
graph.relabel(element_labels)
return graph.plot(layout = layout, **kwds)