# ``igraph`.`adjacency``

module documentation
(source)

Undocumented

Function | `_get_adjacency` | Returns the adjacency matrix of a graph.
Function | `_get_adjacency_sparse` | Returns the adjacency matrix of a graph as a SciPy CSR matrix.
Function | `_get_adjlist` | Returns the adjacency list representation of the graph.
Function | `_get_biadjacency` | Returns the bipartite adjacency matrix of a bipartite graph. The bipartite adjacency matrix is an n times m matrix, where n and m are the number of vertices in the two vertex classes.
Function | `_get_inclist` | Returns the incidence list representation of the graph.

def _get_adjacency(self, type=GET_ADJACENCY_BOTH, attribute=None, default=0, eids=False): (source)

Returns the adjacency matrix of a graph.

Parameters
self | Undocumented
type | either `GET_ADJACENCY_LOWER` (uses the lower triangle of the matrix) or `GET_ADJACENCY_UPPER` (uses the upper triangle) or `GET_ADJACENCY_BOTH` (uses both parts). Ignored for directed graphs.

attribute

if `None`, returns the ordinary adjacency matrix. When the name of a valid edge attribute is given here, the matrix returned will contain the default value at the places where there is no edge or the value of the given attribute where there is an edge. Multiple edges are not supported, the value written in the matrix in this case will be unpredictable. This parameter is ignored if eids is `True`

default | the default value written to the cells in the case of adjacency matrices with attributes.
eids | specifies whether the edge IDs should be returned in the adjacency matrix. Since zero is a valid edge ID, the cells in the matrix that correspond to unconnected vertex pairs will contain -1 instead of 0 if eids is `True`. If eids is `False`, the number of edges will be returned in the matrix for each vertex pair.

Returns
the adjacency matrix as a `Matrix`.

def _get_adjacency_sparse(self, attribute=None): (source)

Returns the adjacency matrix of a graph as a SciPy CSR matrix.

Parameters
self | Undocumented
attribute | if `None`, returns the ordinary adjacency matrix. When the name of a valid edge attribute is given here, the matrix returned will contain the default value at the places where there is no edge or the value of the given attribute where there is an edge.

Returns
the adjacency matrix as a `scipy.sparse.csr_matrix`.

def _get_adjlist(self, mode='out', loops='twice', multiple=True): (source)

Returns the adjacency list representation of the graph.

The adjacency list representation is a list of lists. Each item of the outer list belongs to a single vertex of the graph. The inner list contains the neighbors of the given vertex.

Parameters
self | Undocumented
mode | if `"out"`, returns the successors of the vertex. If `"in"`, returns the predecessors of the vertex. If `"all"`, both the predecessors and the successors will be returned. Ignored for undirected graphs.
loops | whether to return loops in undirected graphs once (`"once"`), twice (`"twice"`) or not at all (`"ignore"`). `False` is accepted as an alias to `"ignore"` and `True` is accepted as an alias to `"twice"`. For directed graphs, `"twice"` is equivalent to `"once"` (except when `mode` is `"all"` because the graph is then treated as undirected).
multiple | whether to return endpoints of multiple edges as many times as their multiplicities.

def _get_biadjacency(graph, types='type', *args, **kwds): (source)

Returns the bipartite adjacency matrix of a bipartite graph. The bipartite adjacency matrix is an n times m matrix, where n and m are the number of vertices in the two vertex classes.

Parameters
graph | Undocumented
types | a vector containing the vertex types, or an attribute name. Anything that evalulates to `False` corresponds to vertices of the first kind, everything else to the second kind.
*args | Undocumented
**kwds | Undocumented

Returns
the bipartite adjacency matrix and two lists in a triplet. The first list defines the mapping between row indices of the matrix and the original vertex IDs. The second list is the same for the column indices.

def _get_inclist(graph, mode='out', loops='twice'): (source)

Returns the incidence list representation of the graph.

The incidence list representation is a list of lists. Each item of the outer list belongs to a single vertex of the graph. The inner list contains the IDs of the incident edges of the given vertex.

Parameters
graph | Undocumented
mode | if `"out"`, returns the successors of each vertex. If `"in"`, returns the predecessors of each vertex. If `"all"`, both the predecessors and the successors will be returned. Ignored for undirected graphs.
loops | whether to return loops in undirected graphs once (`"once"`), twice (`"twice"`) or not at all (`"ignore"`). `False` is accepted as an alias to `"ignore"` and `True` is accepted as an alias to `"twice"`. For directed graphs, `"twice"` is equivalent to `"once"` (except when `mode` is `"all"` because the graph is then treated as undirected).