package documentation

Undocumented

Module adjacency No module docstring; 5/5 functions documented
Package app User interfaces of igraph
Module automorphisms No module docstring; 2/2 functions documented
Module basic No module docstring; 8/8 functions documented
Module bipartite No module docstring; 3/3 functions documented
Module clustering Classes related to graph clustering.
Module community No module docstring; 13/13 functions documented
Module configuration Configuration framework for igraph.
Module cut Classes representing cuts and flows on graphs.
Module datatypes Additional auxiliary data types
Package drawing Drawing and plotting routines for igraph.
Module formula Implementation of igraph.Graph.Formula().
Package io Undocumented
Module layout Layout-related code in the igraph library.
Module matching Classes representing matchings on graphs.
Package operators Implementation of union, disjoint union and intersection operators.
Package remote Classes that help igraph communicate with remote applications.
Module seq No module docstring; 1/2 function documented
Module sparse_matrix Implementation of Python-level sparse matrix operations.
Module statistics Statistics related stuff in igraph
Module structural No module docstring; 5/5 functions documented
Module summary Summary representation of a graph.
Module utils Utility functions that cannot be categorised anywhere else.
Module version Undocumented
Module _igraph Low-level Python interface for the igraph library. Should not be used directly.

From __init__.py:

Class ARPACKOptions Class representing the parameters of the ARPACK module.
Class BFSIter igraph BFS iterator object
Class Clustering Class representing a clustering of an arbitrary ordered set.
Class CohesiveBlocks The cohesive block structure of a graph.
Class Configuration Class representing igraph configuration details.
Class Cover Class representing a cover of an arbitrary ordered set.
Class Cut A cut of a given graph.
Class Dendrogram The hierarchical clustering (dendrogram) of some dataset.
Class DFSIter igraph DFS iterator object
Class DyadCensus Dyad census of a graph.
Class Edge Class representing a single edge in a graph.
Class EdgeSeq Class representing a sequence of edges in the graph.
Class Flow A flow of a given graph.
Class Graph Generic graph.
Class GraphBase Low-level representation of a graph.
Class InternalError Undocumented
Class Matching A matching of vertices in a graph.
Class TriadCensus Triad census of a graph.
Class UniqueIdGenerator A dictionary-like class that can be used to assign unique IDs to names (say, vertex names).
Class Vertex Class representing a single vertex in a graph.
Class VertexClustering The clustering of the vertex set of a graph.
Class VertexCover The cover of the vertex set of a graph.
Class VertexDendrogram The dendrogram resulting from the hierarchical clustering of the vertex set of a graph.
Class VertexSeq Class representing a sequence of vertices in the graph.
Function community_to_membership Undocumented
Function compare_communities Compares two community structures using various distance measures.
Function convex_hull Calculates the convex hull of a given point set.
Function get_include Returns the folder that contains the C API headers of the Python interface of igraph.
Function is_bigraphical Returns whether two sequences of integers can be the degree sequences of a bipartite graph.
Function is_degree_sequence Deprecated since 0.9 in favour of is_graphical().
Function is_graphical Returns whether a list of degrees can be a degree sequence of some graph, with or without multiple and loop edges, depending on the allowed edge types in the remaining arguments.
Function is_graphical_degree_sequence Deprecated since 0.9 in favour of is_graphical().
Function read Loads a graph from the given filename.
Function set_progress_handler Sets the handler to be called when igraph is performing a long operation.
Function set_random_number_generator Sets the random number generator used by igraph.
Function set_status_handler Sets the handler to be called when igraph tries to display a status message.
Function split_join_distance Calculates the split-join distance between two community structures.
Function umap_compute_weights Compute undirected UMAP weights from directed distance graph. UMAP is a layout algorithm that usually takes as input a directed distance graph, for instance a k nearest neighbor graph based on Euclidean distance between points in a vector space...
Function write Saves a graph to the given file.
Variable __license__ Undocumented
Variable __version__ Undocumented
Variable __version_info__ Undocumented
Variable config The main configuration object of igraph. Use this object to modify igraph's behaviour, typically when used in interactive mode.
__license__: str = (source)

Undocumented

def community_to_membership(merges, nodes, steps, return_csize=False):

Undocumented

def convex_hull(vs, coords=False):

Calculates the convex hull of a given point set.

Parameters
vsthe point set as a list of lists
coordsif True, the function returns the coordinates of the corners of the convex hull polygon, otherwise returns the corner indices.
Returns
either the hull's corner coordinates or the point indices corresponding to them, depending on the coords parameter.
def is_bigraphical(degrees1, degrees2, multiple=False):

Returns whether two sequences of integers can be the degree sequences of a bipartite graph.

The bipartite graph may or may not have multiple edges, depending on the allowed edge types in the remaining arguments.

Parameters
degrees1the list of degrees in the first partition.
degrees2the list of degrees in the second partition.
multiplewhether multiple edges are allowed.
Returns
True if there exists some bipartite graph that can realize the given degree sequences with or without multiple edges, False otherwise.
def is_degree_sequence(out_deg, in_deg=None):

Deprecated since 0.9 in favour of is_graphical().

Returns whether a list of degrees can be a degree sequence of some graph.

Note that it is not required for the graph to be simple; in other words, this function may return True for degree sequences that can be realized using one or more multiple or loop edges only.

In particular, this function checks whether

  • all the degrees are non-negative
  • for undirected graphs, the sum of degrees are even
  • for directed graphs, the two degree sequences are of the same length and equal sums
Parameters
out_degthe list of degrees. For directed graphs, this list must contain the out-degrees of the vertices.
in_degthe list of in-degrees for directed graphs. This parameter must be None for undirected graphs.
Returns
True if there exists some graph that can realize the given degree sequence, False otherwise.
def is_graphical(out_deg, in_deg=None, loops=False, multiple=False):

Returns whether a list of degrees can be a degree sequence of some graph, with or without multiple and loop edges, depending on the allowed edge types in the remaining arguments.

Parameters
out_degthe list of degrees. For directed graphs, this list must contain the out-degrees of the vertices.
in_degthe list of in-degrees for directed graphs. This parameter must be None for undirected graphs.
loopswhether loop edges are allowed.
multiplewhether multiple edges are allowed.
Returns
True if there exists some graph that can realize the given degree sequence with the given edge types, False otherwise.
def is_graphical_degree_sequence(out_deg, in_deg=None):

Deprecated since 0.9 in favour of is_graphical().

Returns whether a list of degrees can be a degree sequence of some simple graph.

Note that it is required for the graph to be simple; in other words, this function will return False for degree sequences that cannot be realized without using one or more multiple or loop edges.

Parameters
out_degthe list of degrees. For directed graphs, this list must contain the out-degrees of the vertices.
in_degthe list of in-degrees for directed graphs. This parameter must be None for undirected graphs.
Returns
True if there exists some simple graph that can realize the given degree sequence, False otherwise.
def set_progress_handler(handler):

Sets the handler to be called when igraph is performing a long operation.

Parameters
handlerthe progress handler function. It must accept two arguments, the first is the message informing the user about what igraph is doing right now, the second is the actual progress information (a percentage).
def set_random_number_generator(generator):

Sets the random number generator used by igraph.

Parameters
generatorthe generator to be used. It must be a Python object with at least three attributes: random, randint and gauss. Each of them must be callable and their signature and behaviour must be identical to random.random, random.randint and random.gauss. Optionally, the object can provide a function named getrandbits with a signature identical to randpm.getrandbits that provides a given number of random bits on demand. By default, igraph uses the random module for random number generation, but you can supply your alternative implementation here. If the given generator is None, igraph reverts to the default PCG32 generator implemented in the C layer, which might be slightly faster than calling back to Python for random numbers, but you cannot set its seed or save its state.
def set_status_handler(handler):

Sets the handler to be called when igraph tries to display a status message.

This is used to communicate the progress of some calculations where no reasonable progress percentage can be given (so it is not possible to use the progress handler).

Parameters
handlerthe status handler function. It must accept a single argument, the message that informs the user about what igraph is doing right now.
def umap_compute_weights(graph, dist):

Compute undirected UMAP weights from directed distance graph. UMAP is a layout algorithm that usually takes as input a directed distance graph, for instance a k nearest neighbor graph based on Euclidean distance between points in a vector space. The graph is directed because vertex v1 might consider vertex v2 a close neighbor, but v2 itself might have many neighbors that are closer than v1. This function computes the symmetrized weights from the distance graph using union as the symmetry operator. In simple terms, if either vertex considers the other a close neighbor, they will be treated as close neighbors.

This function can be used as a separate preprocessing step to Graph.layout_umap(). For efficiency reasons, the returned weights have the same length as the input distances, however because of the symmetryzation some information is lost. Therefore, the weight of one of the edges is set to zero whenever edges in opposite directions are found in the input distance graph. You can pipe the output of this function directly into Graph.layout_umap() as follows: weights = igraph.umap_compute_weights(graph, dist) layout = graph.layout_umap(weights=weights)

Parameters
graphdirected graph to compute weights for.
distdistances associated with the graph edges.
Returns
Symmetrized weights associated with each edge. If the distance graph has both directed edges between a pair of vertices, one of the returned weights will be set to zero.
See Also
Graph.layout_umap()
def compare_communities(comm1, comm2, method='vi', remove_none=False): (source)

Compares two community structures using various distance measures.

For measures involving entropies (e.g., the variation of information metric), igraph uses natural logarithms.

References

  • Meila M: Comparing clusterings by the variation of information. In: Scholkopf B, Warmuth MK (eds). Learning Theory and Kernel Machines: 16th Annual Conference on Computational Learning Theory and 7th Kernel Workship, COLT/Kernel 2003, Washington, DC, USA. Lecture Notes in Computer Science, vol. 2777, Springer, 2003. ISBN: 978-3-540-40720-1.
  • Danon L, Diaz-Guilera A, Duch J, Arenas A: Comparing community structure identification. J Stat Mech P09008, 2005.
  • van Dongen S: Performance criteria for graph clustering and Markov cluster experiments. Technical Report INS-R0012, National Research Institute for Mathematics and Computer Science in the Netherlands, Amsterdam, May 2000.
  • Rand WM: Objective criteria for the evaluation of clustering methods. J Am Stat Assoc 66(336):846-850, 1971.
  • Hubert L and Arabie P: Comparing partitions. Journal of Classification 2:193-218, 1985.
Parameters
comm1the first community structure as a membership list or as a Clustering object.
comm2the second community structure as a membership list or as a Clustering object.
methodthe measure to use. "vi" or "meila" means the variation of information metric of Meila (2003), "nmi" or "danon" means the normalized mutual information as defined by Danon et al. (2005), "split-join" means the split-join distance of van Dongen (2000), "rand" means the Rand index of Rand (1971), "adjusted_rand" means the adjusted Rand index of Hubert and Arabie (1985).
remove_nonewhether to remove None entries from the membership lists. This is handy if your Clustering object was constructed using VertexClustering.FromAttribute using an attribute which was not defined for all the vertices. If remove_none is False, a None entry in either comm1 or comm2 will result in an exception. If remove_none is True, None values are filtered away and only the remaining lists are compared.
Returns
the calculated measure.
def split_join_distance(comm1, comm2, remove_none=False): (source)

Calculates the split-join distance between two community structures.

The split-join distance is a distance measure defined on the space of partitions of a given set. It is the sum of the projection distance of one partition from the other and vice versa, where the projection number of A from B is if calculated as follows:

  1. For each set in A, find the set in B with which it has the maximal overlap, and take note of the size of the overlap.
  2. Take the sum of the maximal overlap sizes for each set in A.
  3. Subtract the sum from n, the number of elements in the partition.

Note that the projection distance is asymmetric, that's why it has to be calculated in both directions and then added together. This function returns the projection distance of comm1 from comm2 and the projection distance of comm2 from comm1, and returns them in a pair. The actual split-join distance is the sum of the two distances. The reason why it is presented this way is that one of the elements being zero then implies that one of the partitions is a subpartition of the other (and if it is close to zero, then one of the partitions is close to being a subpartition of the other).

Reference: van Dongen S: Performance criteria for graph clustering and Markov cluster experiments. Technical Report INS-R0012, National Research Institute for Mathematics and Computer Science in the Netherlands, Amsterdam, May 2000.

Parameters
comm1the first community structure as a membership list or as a Clustering object.
comm2the second community structure as a membership list or as a Clustering object.
remove_nonewhether to remove None entries from the membership lists. This is handy if your Clustering object was constructed using VertexClustering.FromAttribute using an attribute which was not defined for all the vertices. If remove_none is False, a None entry in either comm1 or comm2 will result in an exception. If remove_none is True, None values are filtered away and only the remaining lists are compared.
Returns
the projection distance of comm1 from comm2 and vice versa in a tuple. The split-join distance is the sum of the two.
See Also
compare_communities() with method = "split-join" if you are not interested in the individual projection distances but only the sum of them.
__version__ = (source)

Undocumented

__version_info__: tuple[int, ...] = (source)

Undocumented

def get_include(): (source)

Returns the folder that contains the C API headers of the Python interface of igraph.

def read(filename, *args, **kwds): (source)

Loads a graph from the given filename.

This is just a convenience function, calls Graph.Read directly. All arguments are passed unchanged to Graph.Read

Parameters
filenamethe name of the file to be loaded
*argsUndocumented
**kwdsUndocumented
def write(graph, filename, *args, **kwds): (source)

Saves a graph to the given file.

This is just a convenience function, calls Graph.write directly. All arguments are passed unchanged to Graph.write

Parameters
graphthe graph to be saved
filenamethe name of the file to be written
*argsUndocumented
**kwdsUndocumented

The main configuration object of igraph. Use this object to modify igraph's behaviour, typically when used in interactive mode.