5 if len(ig.get_vertices())==0:
11 return self.p.get_name()
12 def __call__(self, name):
13 return self.p.__call__(name)
15 for vi
in ig.get_vertices():
16 n= ig.get_vertex_name(vi)
17 g.add_node(NodeWrapper(n))
18 for vi
in ig.get_vertices():
19 n= ig.get_vertex_name(vi)
20 for ni
in ig.get_out_neighbors(vi):
21 nn= ig.get_vertex_name(ni)
22 g.add_edge(NodeWrapper(n), NodeWrapper(nn))
32 n1= str(n0).replace(
'"',
'')
33 n2= n1.replace(
"\n",
'')
36 from altgraph
import Graph, Dot
38 for i,v
in enumerate(g.get_vertices()):
40 for i,v
in enumerate(g.get_vertices()):
41 for n
in g.get_out_neighbors(v):
44 for i,v
in enumerate(g.get_vertices()):
45 dot.node_style(i, label=clean(g.get_vertex_name(v)))
52 st= g.get_graphviz_string()
53 open(tfn,
"w").write(st)
58 print >> sys.stderr,
"Cannot run dot on Python 2.3 systems."
62 sp=subprocess.Popen([
"dot",
"-Tpdf", tfn,
"-o"+tfon])
66 print >> sys.stderr,
"The dot command from the graphviz package was not found. Please make sure it is in the PATH passed to IMP."
69 if platform.system() ==
"Darwin":
72 cmd=[
"gv",
"acroread",
"xpdf"]
75 print "launching viewer", c
77 subprocess.check_call([c, tfon])
83 print "Could not display file. It is saved at", tfon
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
See IMP.base for more information.
std::string show_graphviz(Graph g)
networkx::DiGraph get_networkx_graph(Graph g)
void show_altgraph(Graph g)