I posted code with missing lines... here is the good code: #!/usr/bin/python """ Create graphs in networkx and graph-tool. """ import networkx as nx from graph_tool.all import * import igraph from itertools import combinations def graph_tool_create(): """ Create a graph_tool graph given a list of pairs. """ G = Graph(directed=False) objectTOv = {} for o1,o2 in get_pairs_of_objects(): if(o1 in objectTOv): u = objectTOv[o1] else: u = G.add_vertex() objectTOv[o1] = u if(o2 in objectTOv): v = objectTOv[o2] else: v = G.add_vertex() objectTOv[o2] G.add_edge(u,v) def nx_create(): """ Create a graph_tool graph given a list of pairs. """ G = nx.Graph() for o1,o2 in get_pairs_of_objects(): G.add_edge(o1,o2) def get_pairs_of_objects(): """ Generate pairs of objects. """ n = 3000 for a,b in combinations(range(n),2): yield a,b graph_tool_create() nx_create() -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.