from graph import nb_edges import string def fac(n): f = 1 i = 1 while i <= n: f = f * i i = i + 1 return f #Auber add 10/09/2002 def fact(n): if n>0: return n*fact(n-1) else : return 1 #Auber add 10/09/2002 #Export a graph in tlp format, thus it can be displayed :) #tlp format is used by the tulip program, http://www.tulip-software.org #Need to be extended in order to write into a file #I don't know how to do it yet. :-) def exportTlp(graph): idn = {} i = 0 while i < len(graph.nodes): idn[graph.nodes[i]]= i + 1 i = i + 1 print "(nodes", i = 0 for i in range(len(graph.nodes)): print i + 1, print ')' i = 0 for i in range (nb_edges(graph)): print "(edge ", print i + 1, print idn[graph.edges[i].start], print idn[graph.edges[i].end], print ')' i = i + 1