python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Module _igraph
[hide private]

Module _igraph

Low-level Python interface for the igraph library. Should not be used directly.


Version: 0.7.1

Classes [hide private]
  InternalError
Functions [hide private]
 
convex_hull(vs, coords=False)
Calculates the convex hull of a given point set.
 
is_degree_sequence(out_deg, in_deg=None)
Returns whether a list of degrees can be a degree sequence of some graph.
 
is_graphical_degree_sequence(out_deg, in_deg=None)
Returns whether a list of degrees can be a degree sequence of some simple graph.
 
set_progress_handler(handler)
Sets the handler to be called when igraph is performing a long operation.
 
set_random_number_generator(generator)
Sets the random number generator used by igraph.
 
set_status_handler(handler)
Sets the handler to be called when igraph tries to display a status message.
Variables [hide private]
  ADJ_DIRECTED = 0
  ADJ_LOWER = 3
  ADJ_MAX = 1
  ADJ_MIN = 4
  ADJ_PLUS = 5
  ADJ_UNDIRECTED = 1
  ADJ_UPPER = 2
  ALL = 3
  BLISS_F = 0
  BLISS_FL = 1
  BLISS_FLM = 4
  BLISS_FM = 3
  BLISS_FS = 2
  BLISS_FSM = 5
  GET_ADJACENCY_BOTH = 2
  GET_ADJACENCY_LOWER = 1
  GET_ADJACENCY_UPPER = 0
  IN = 2
  OUT = 1
  REWIRING_SIMPLE = 0
  REWIRING_SIMPLE_LOOPS = 1
  STAR_IN = 1
  STAR_MUTUAL = 3
  STAR_OUT = 0
  STAR_UNDIRECTED = 2
  STRONG = 2
  TRANSITIVITY_NAN = 0
  TRANSITIVITY_ZERO = 1
  TREE_IN = 1
  TREE_OUT = 0
  TREE_UNDIRECTED = 2
  WEAK = 1
  _C_API = <PyCObject object at 0x1035c6f30>
  __build_date__ = 'May 10 2019'
  __package__ = None
hash(x)
  arpack_options = <igraph.ARPACKOptions object at 0x10322ed30>

Imports: ARPACKOptions, BFSIter, Edge, EdgeSeq, GraphBase, Vertex, VertexSeq


Function Details [hide private]

convex_hull(vs, coords=False)

 

Calculates the convex hull of a given point set.

Parameters:
  • vs - the point set as a list of lists
  • coords - if 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.

is_degree_sequence(out_deg, in_deg=None)

 

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_deg - the list of degrees. For directed graphs, this list must contain the out-degrees of the vertices.
  • in_deg - the 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.@see: is_graphical_degree_sequence() if you do not want to allow multiple or loop edges.

is_graphical_degree_sequence(out_deg, in_deg=None)

 

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_deg - the list of degrees. For directed graphs, this list must contain the out-degrees of the vertices.
  • in_deg - the 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.

See Also: is_degree_sequence() if you want to allow multiple or loop edges.

set_progress_handler(handler)

 

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

Parameters:
  • handler - the 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).

set_random_number_generator(generator)

 

Sets the random number generator used by igraph.

Parameters:
  • generator - the 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. 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 Mersenne twister 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.

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:
  • handler - the status handler function. It must accept a single argument, the message that informs the user about what igraph is doing right now.

   Home       Trees       Indices       Help