python-igraph API reference

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

module documentation

Undocumented

Function _construct_incidence_bipartite_graph Creates a bipartite graph from an incidence matrix.
Function _construct_bipartite_graph No summary
Function _construct_full_bipartite_graph Generates a full bipartite graph (directed or undirected, with or without loops).
Function _construct_random_bipartite_graph Generates a random bipartite graph with the given number of vertices and edges (if m is given), or with the given number of vertices and the given connection probability (if p is given).
def _construct_incidence_bipartite_graph(cls, matrix, directed=False, mode='out', multiple=False, weighted=None, *args, **kwds):

Creates a bipartite graph from an incidence matrix.

Example:

>>> g = Graph.Incidence([[0, 1, 1], [1, 1, 0]])
Parametersmatrixthe incidence matrix.
directedwhether to create a directed graph.
modedefines the direction of edges in the graph. If "out", then edges go from vertices of the first kind (corresponding to rows of the matrix) to vertices of the second kind (the columns of the matrix). If "in", the opposite direction is used. "all" creates mutual edges. Ignored for undirected graphs.
multipledefines what to do with non-zero entries in the matrix. If False, non-zero entries will create an edge no matter what the value is. If True, non-zero entries are rounded up to the nearest integer and this will be the number of multiple edges created.
weighteddefines whether to create a weighted graph from the incidence matrix. If it is c{None} then an unweighted graph is created and the multiple argument is used to determine the edges of the graph. If it is a string then for every non-zero matrix entry, an edge is created and the value of the entry is added as an edge attribute named by the weighted argument. If it is True then a weighted graph is created and the name of the edge attribute will be ‘weight’.
argsUndocumented
kwdsUndocumented
Returnsthe graph with a binary vertex attribute named "type" that stores the vertex classes.
RaisesValueErrorif the weighted and multiple are passed together.
def _construct_bipartite_graph(cls, types, edges, directed=False, *args, **kwds):

Creates a bipartite graph with the given vertex types and edges. This is similar to the default constructor of the graph, the only difference is that it checks whether all the edges go between the two vertex classes and it assigns the type vector to a type attribute afterwards.

Examples:

>>> g = Graph.Bipartite([0, 1, 0, 1], [(0, 1), (2, 3), (0, 3)])
>>> g.is_bipartite()
True
>>> g.vs["type"]
[False, True, False, True]
Parameterstypesthe vertex types as a boolean list. Anything that evaluates to False will denote a vertex of the first kind, anything that evaluates to True will denote a vertex of the second kind.
edgesthe edges as a list of tuples.
directedwhether to create a directed graph. Bipartite networks are usually undirected, so the default is False
argsUndocumented
kwdsUndocumented
Returnsthe graph with a binary vertex attribute named "type" that stores the vertex classes.
def _construct_full_bipartite_graph(cls, n1, n2, directed=False, mode='all', *args, **kwds):

Generates a full bipartite graph (directed or undirected, with or without loops).

>>> g = Graph.Full_Bipartite(2, 3)
>>> g.is_bipartite()
True
>>> g.vs["type"]
[False, False, True, True, True]
Parametersn1the number of vertices of the first kind.
n2the number of vertices of the second kind.
directedwhether tp generate a directed graph.
modeif "out", then all vertices of the first kind are connected to the others; "in" specifies the opposite direction, "all" creates mutual edges. Ignored for undirected graphs.
argsUndocumented
kwdsUndocumented
Returnsthe graph with a binary vertex attribute named "type" that stores the vertex classes.
def _construct_random_bipartite_graph(cls, n1, n2, p=None, m=None, directed=False, neimode='all', *args, **kwds):

Generates a random bipartite graph with the given number of vertices and edges (if m is given), or with the given number of vertices and the given connection probability (if p is given).

If m is given but p is not, the generated graph will have n1 vertices of type 1, n2 vertices of type 2 and m randomly selected edges between them. If p is given but m is not, the generated graph will have n1 vertices of type 1 and n2 vertices of type 2, and each edge will exist between them with probability p.

Parametersn1the number of vertices of type 1.
n2the number of vertices of type 2.
pthe probability of edges. If given, m must be missing.
mthe number of edges. If given, p must be missing.
directedwhether to generate a directed graph.
neimodeif the graph is directed, specifies how the edges will be generated. If it is "all", edges will be generated in both directions (from type 1 to type 2 and vice versa) independently. If it is "out" edges will always point from type 1 to type 2. If it is "in", edges will always point from type 2 to type 1. This argument is ignored for undirected graphs.
argsUndocumented
kwdsUndocumented
API Documentation for python-igraph, generated by pydoctor 21.2.2 at 2021-10-18 16:23:19.