python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Module operators
[hide private]

Module operators

source code

Implementation of union, disjoint union and intersection operators.

License: Copyright (C) 2006-2012 Tamás Nepusz <ntamas@gmail.com> Pázmány Péter sétány 1/a, 1117 Budapest, Hungary This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Functions [hide private]
 
disjoint_union(graphs)
Graph disjoint union.
source code
 
union(graphs, byname='auto')
Graph union.
source code
 
intersection(graphs, byname='auto', keep_all_vertices=True)
Graph intersection.
source code
Variables [hide private]
  __package__ = 'igraph'

Imports: GraphBase, _union, _intersection, _disjoint_union, defaultdict, Counter, warn


Function Details [hide private]

disjoint_union(graphs)

source code 

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.

@param graph: list of graphs. A lazy sequence is not acceptable. @return: the disjoint union graph

union(graphs, byname='auto')

source code 
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.

@param graph: list of graphs. A lazy sequence is not acceptable.
@param 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).
@return: the union graph

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

source code 
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.

@param graph: list of graphs. A lazy sequence is not acceptable.
@param 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.
@return: the intersection graph


   Home       Trees       Indices       Help