python-igraph API reference

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

module documentation

Undocumented

Function _construct_graph_from_adjacency Generates a graph from its adjacency matrix.
Function _construct_graph_from_weighted_adjacency Generates a graph from its weighted adjacency matrix.
def _construct_graph_from_adjacency(cls, matrix, mode='directed', *args, **kwargs):

Generates a graph from its adjacency matrix.

Parametersmatrixthe adjacency matrix. Possible types are:
  • a list of lists
  • a numpy 2D array or matrix (will be converted to list of lists)
  • a scipy.sparse matrix (will be converted to a COO matrix, but not to a dense matrix)
  • a pandas.DataFrame (column/row names must match, and will be used as vertex names).
modethe mode to be used. Possible values are:
  • "directed" - the graph will be directed and a matrix element gives the number of edges between two vertex.
  • "undirected" - alias to "max" for convenience.
  • "max" - undirected graph will be created and the number of edges between vertex i and j is max(A(i,j), A(j,i))
  • "min" - like "max", but with min(A(i,j), A(j,i))
  • "plus" - like "max", but with A(i,j) + A(j,i)
  • "upper" - undirected graph with the upper right triangle of the matrix (including the diagonal)
  • "lower" - undirected graph with the lower left triangle of the matrix (including the diagonal)
argsUndocumented
kwargsUndocumented
def _construct_graph_from_weighted_adjacency(cls, matrix, mode='directed', attr='weight', loops=True):

Generates a graph from its weighted adjacency matrix.

Parametersmatrixthe adjacency matrix. Possible types are:
  • a list of lists
  • a numpy 2D array or matrix (will be converted to list of lists)
  • a scipy.sparse matrix (will be converted to a COO matrix, but not to a dense matrix)
modethe mode to be used. Possible values are:
  • "directed" - the graph will be directed and a matrix element gives the number of edges between two vertex.
  • "undirected" - alias to "max" for convenience.
  • "max" - undirected graph will be created and the number of edges between vertex i and j is max(A(i,j), A(j,i))
  • "min" - like "max", but with min(A(i,j), A(j,i))
  • "plus" - like "max", but with A(i,j) + A(j,i)
  • "upper" - undirected graph with the upper right triangle of the matrix (including the diagonal)
  • "lower" - undirected graph with the lower left triangle of the matrix (including the diagonal)

These values can also be given as strings without the ADJ prefix.

attrthe name of the edge attribute that stores the edge weights.
loopswhether to include loop edges. When False, the diagonal of the adjacency matrix will be ignored.
API Documentation for python-igraph, generated by pydoctor 21.2.2 at 2021-10-18 16:23:19.