本文整理汇总了Python中Graph.graph方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.graph方法的具体用法?Python Graph.graph怎么用?Python Graph.graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.graph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import graph [as 别名]
def __init__(self):
self.graph = Graph.graph()
self.listCities = Commands.listCitiesCmd(self.graph)
self.getCityInfo = Commands.getCityInfoCmd(self.graph)
self.getStats = Commands.getStatsCmd(self.graph)
self.getMap = Commands.getMapCmd(self.graph)
self.editDatabase = Commands.editDatabaseCmd(self.graph)
self.writeJSON = Commands.writeJSON(self.graph)
self.shortestRoute = Commands.findShortestRoute(self.graph)
self.addJSON = Commands.addJSON(self.graph)
self.quit = Commands.quitCmd(self.graph)
self.handler = EventHandler.handler(self.listCities, self.getCityInfo, self.getStats, self.getMap,
self.editDatabase, self.writeJSON, self.shortestRoute, self.addJSON, self.quit)
示例2: export
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import graph [as 别名]
def export(self, xot, fields=False, clustertable=False, clustergroup=False, compact=False):
"""generate a dot from a xot"""
g=Graph.graph("xot")
g.overlap='scale'
for group in xot.table_groups.values():
gsg = None
if clustergroup:
gsg = g.add_graph(_ggn(group))
gsg.label = group.name
else:
gsg = g
for table in group.tables.values():
sg = None
if clustertable:
sg = gsg.add_graph(_tgn(table))
sg.label = table.name
else:
sg = gsg
t = sg.add_node(_tnn(table))
t.shape = 'box'
if compact:
t.shape = 'record'
t.label = ["{<__TABLE__>%s|{" % table.name]
for f in table.fields.values():
if compact:
t.label.append("<%s>%s" % (f.name, f.name))
if hasattr(f, 'reference'):
g.add_edge((_fpl(table, f), _tpl(f.reference)))
else:
if fields:
n = sg.add_node(_fnn(table, f))
n.label = f.name
sg.add_edge((_tnn(table), _fnn(table, f)))
if hasattr(f, 'reference'):
if fields:
g.add_edge((_fnn(table, f), _tnn(f.reference)))
n.shape = 'diamond'
n.fillcolor = 'gray'
n.style = 'filled'
else:
g.add_edge((_tnn(table), _tnn(f.reference)))
if compact:
t.label = t.label[0] + "|".join(t.label[1:]) + "}}"
if clustergroup:
for sg in g.get_graphs().values():
if len(sg['graphs']) == 1:
a = sg['graphs'].values()[0]
sg.del_graph(a)
sg = a
return str(g)
示例3: setUp
# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import graph [as 别名]
def setUp(self):
self.graph = Graph.graph()