List of all classes, functions and methods in python-igraph

module documentation

Implementation of union, disjoint union and intersection operators.

Variable | `__docformat__` |
Undocumented |

Variable | `__license__` |
Undocumented |

Function | `disjoint_union` |
Graph disjoint union. |

Function | `union` |
Graph union. |

Function | `intersection` |
Graph intersection. |

def disjoint_union(graphs):

Graph disjoint union.

The disjoint union of two or more graphs is created.

This function keeps the attributes of all graphs. All graph, vertex and edge attributes are copied to the result. If an attribute is present in multiple graphs and would result a name clash, then this attribute is renamed by adding suffixes: _1, _2, etc.

An error is generated if some input graphs are directed and others are undirected.

Parameters | graphs | list of graphs. A lazy sequence is not acceptable. |

Returns | the disjoint union graph |

def union(graphs, byname='auto'):

Graph union.

The union of two or more graphs is created. The graphs may have identical or overlapping vertex sets. Edges which are included in at least one graph will be part of the new graph.

This function keeps the attributes of all graphs. All graph, vertex and edge attributes are copied to the result. If an attribute is present in multiple graphs and would result a name clash, then this attribute is renamed by adding suffixes: _1, _2, etc.

The 'name' vertex attribute is treated specially if the operation is performed based on symbolic vertex names. In this case 'name' must be present in all graphs, and it is not renamed in the result graph.

An error is generated if some input graphs are directed and others are undirected.

Parameters | graphs | list of graphs. A lazy sequence is not acceptable. |

byname | bool or 'auto' specifying the function behaviour with respect to names vertices (i.e. vertices with the 'name' attribute). If False, ignore vertex names. If True, merge vertices based on names. If 'auto', use True if all graphs have named vertices and False otherwise (in the latter case, a warning is generated too). | |

Returns | the union graph |

def intersection(graphs, byname='auto', keep_all_vertices=True):

Graph intersection.

The intersection of two or more graphs is created. The graphs may have identical or overlapping vertex sets. Edges which are included in all graphs will be part of the new graph.

This function keeps the attributes of all graphs. All graph, vertex and edge attributes are copied to the result. If an attribute is present in multiple graphs and would result a name clash, then this attribute is renamed by adding suffixes: _1, _2, etc.

The 'name' vertex attribute is treated specially if the operation is performed based on symbolic vertex names. In this case 'name' must be present in all graphs, and it is not renamed in the result graph.

An error is generated if some input graphs are directed and others are undirected.

Parameters | graphs | list of graphs. A lazy sequence is not acceptable. |

byname | bool or 'auto' specifying the function behaviour with respect to names vertices (i.e. vertices with the 'name' attribute). If False, ignore vertex names. If True, merge vertices based on names. If 'auto', use True if all graphs have named vertices and False otherwise (in the latter case, a warning is generated too). | |

keep_all_vertices | bool specifying if vertices that are not present in all graphs should be kept in the intersection. | |

Returns | the intersection graph |