> Why graph_union does not have "owner" attribute? Unfortunately the disjoint_union method does not handle attributes properly yet; you can work around this by exploiting the fact that the vertex and edge IDs of the first graph will be the same in the union graph as well:
def get_attrs_or_nones(seq, attr_name); try: return seq[attr_name] except KeyError: return [None] * len(seq) def better_disjoint_union(g1, g2): g = g1+g2 vertex_attributes = set(g.vertex_attributes() + g2.vertex_attributes()) edge_attributes = set(g.edge_attributes() + g2.edge_attributes()) for attr in vertex_attributes: g.vs[attr] = get_attrs_or_nones(g1.vs, attr) + get_attrs_or_nones(g2.vs, attr) for attr in edge_attributes: g.es[attr] = get_attrs_or_nones(g1.es, attr) + get_attrs_or_nones(g2.es, attr) return g (Untested, but shows the general idea: if g1 has N vertices and M edges, then the first N vertices and the first M edges in the union will belong to g1 in the same order as in g1, and the rest belongs to g2 in the same order as in g2). All the best, T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
