module documentation

Undocumented

Function _add_edge Adds a single edge to the graph.
Function _add_edges Adds some edges to the graph.
Function _add_vertex Adds a single vertex to the graph. Keyword arguments will be assigned as vertex attributes. Note that name as a keyword argument is treated specially; if a graph has name as a vertex attribute, it allows one to refer to vertices by their names in most places where igraph expects a vertex ID.
Function _add_vertices Adds some vertices to the graph.
Function _as_directed Returns a directed copy of this graph. Arguments are passed on to GraphBase.to_directed() that is invoked on the copy.
Function _as_undirected Returns an undirected copy of this graph. Arguments are passed on to GraphBase.to_undirected() that is invoked on the copy.
Function _clear Clears the graph, deleting all vertices, edges, and attributes.
Function _delete_edges Deletes some edges from the graph.
def _add_edge(graph, source, target, **kwds): (source)

Adds a single edge to the graph.

Keyword arguments (except the source and target arguments) will be assigned to the edge as attributes.

The performance cost of adding a single edge or several edges to a graph is similar. Thus, when adding several edges, a single add_edges() call is more efficient than multiple add_edge() calls.

Parameters
graphUndocumented
sourcethe source vertex of the edge or its name.
targetthe target vertex of the edge or its name.
**kwdsUndocumented
Returns
the newly added edge as an Edge object. Use add_edges([(source, target)]) if you don't need the Edge object and want to avoid the overhead of creating it.
def _add_edges(graph, es, attributes=None): (source)

Adds some edges to the graph.

Parameters
graphUndocumented
esthe list of edges to be added. Every edge is represented with a tuple containing the vertex IDs or names of the two endpoints. Vertices are enumerated from zero.
attributesdict of sequences, each of length equal to the number of edges to be added, containing the attributes of the new edges.
def _add_vertex(graph, name=None, **kwds): (source)

Adds a single vertex to the graph. Keyword arguments will be assigned as vertex attributes. Note that name as a keyword argument is treated specially; if a graph has name as a vertex attribute, it allows one to refer to vertices by their names in most places where igraph expects a vertex ID.

Returns
the newly added vertex as a Vertex object. Use add_vertices(1) if you don't need the Vertex object and want to avoid the overhead of creating t.
def _add_vertices(graph, n, attributes=None): (source)

Adds some vertices to the graph.

Note that if n is a sequence of strings, indicating the names of the new vertices, and attributes has a key name, the two conflict. In that case the attribute will be applied.

Parameters
graphUndocumented
nthe number of vertices to be added, or the name of a single vertex to be added, or a sequence of strings, each corresponding to the name of a vertex to be added. Names will be assigned to the name vertex attribute.
attributesdict of sequences, each of length equal to the number of vertices to be added, containing the attributes of the new vertices. If n is a string (so a single vertex is added), then the values of this dict are the attributes themselves, but if n=1 then they have to be lists of length 1.
def _as_directed(graph, *args, **kwds): (source)

Returns a directed copy of this graph. Arguments are passed on to GraphBase.to_directed() that is invoked on the copy.

def _as_undirected(graph, *args, **kwds): (source)

Returns an undirected copy of this graph. Arguments are passed on to GraphBase.to_undirected() that is invoked on the copy.

def _clear(graph): (source)

Clears the graph, deleting all vertices, edges, and attributes.

See Also
GraphBase.delete_vertices and Graph.delete_edges.
def _delete_edges(graph, *args, **kwds): (source)

Deletes some edges from the graph.

The set of edges to be deleted is determined by the positional and keyword arguments. If the function is called without any arguments, all edges are deleted. If any keyword argument is present, or the first positional argument is callable, an edge sequence is derived by calling EdgeSeq.select with the same positional and keyword arguments. Edges in the derived edge sequence will be removed. Otherwise, the first positional argument is considered as follows:

Deprecation notice: delete_edges(None) has been replaced by delete_edges() - with no arguments - since igraph 0.8.3.

  • None - deletes all edges (deprecated since 0.8.3)
  • a single integer - deletes the edge with the given ID
  • a list of integers - deletes the edges denoted by the given IDs
  • a list of 2-tuples - deletes the edges denoted by the given source-target vertex pairs. When multiple edges are present between a given source-target vertex pair, only one is removed.