python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph
[hide private]

Package igraph

source code

IGraph library.


Version: 0.7.0

License: Copyright (C) 2006-2012 Tamás Nepusz <ntamas@gmail.com> Pázmány Péter sétány 1/a, 1117 Budapest, Hungary This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Submodules [hide private]

Classes [hide private]
  Vertex
Class representing a single vertex in a graph.
  Graph
Generic graph.
  VertexSeq
Class representing a sequence of vertices in the graph.
  EdgeSeq
Class representing a sequence of edges in the graph.
  ARPACKOptions
Class representing the parameters of the ARPACK module.
  BFSIter
igraph BFS iterator object
  Edge
Class representing a single edge in a graph.
  GraphBase
Low-level representation of a graph.
Functions [hide private]
 
autocurve(graph, attribute='curved', default=0)
Calculates curvature values for each of the edges in the graph to make sure that multiple edges are shown properly on a graph plot.
source code
 
read(filename, *args, **kwds)
Loads a graph from the given filename.
source code
 
load(filename, *args, **kwds)
Loads a graph from the given filename.
source code
 
write(graph, filename, *args, **kwds)
Saves a graph to the given file.
source code
 
save(graph, filename, *args, **kwds)
Saves a graph to the given file.
source code
 
summary(obj, stream=None, *args, **kwds)
Prints a summary of object o to a given stream
source code
Variables [hide private]
  config = None
  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
  __package__ = 'igraph'
  arpack_options = <igraph.ARPACKOptions object at 0x7ff10b83fa20>
  name = 'write_svg'

Imports: __build_date__, Clustering, split_join_distance, Dendrogram, deepcopy, community_to_membership, VertexCover, VertexDendrogram, Cover, str_to_orientation, StringIO, compare_communities, CohesiveBlocks, property, Cut, Flow, Configuration, Plot, plot, Point, DefaultGraphDrawer, Rectangle, known_colors, Palette, hsla_to_rgba, GradientPalette, rgb_to_hsv, AdvancedGradientPalette, ClusterColoringPalette, hsl_to_rgb, rgba_to_hsva, color_name_to_rgb, RainbowPalette, PrecalculatedPalette, rgb_to_hsl, palettes, hsv_to_rgb, color_name_to_rgba, rgba_to_hsla, hsva_to_rgba, DyadCensus, TriadCensus, Matrix, UniqueIdGenerator, islice, cos, Layout, BoundingBox, pi, sin, VertexClustering, Matching, Nexus, NexusConnection, quantile, median, RunningMean, Histogram, percentile, power_law_fit, FittedPowerLaw, mean, GraphSummary, safemax, rescale, safemin, named_temporary_file, multidict, dbl_epsilon, os, math, gzip, sys, operator, defaultdict, izip, mkstemp, warn, InternalError, _igraph, clustering, compat, configuration, convex_hull, cut, datatypes, drawing, formula, is_degree_sequence, is_graphical_degree_sequence, layout, matching, remote, set_progress_handler, set_random_number_generator, set_status_handler, statistics, utils, vendor


Function Details [hide private]

autocurve(graph, attribute='curved', default=0)

source code 

Calculates curvature values for each of the edges in the graph to make sure that multiple edges are shown properly on a graph plot.

This function checks the multiplicity of each edge in the graph and assigns curvature values (numbers between -1 and 1, corresponding to CCW (-1), straight (0) and CW (1) curved edges) to them. The assigned values are either stored in an edge attribute or returned as a list, depending on the value of the attribute argument.

Parameters:
  • graph - the graph on which the calculation will be run
  • attribute - the name of the edge attribute to save the curvature values to. The default value is curved, which is the name of the edge attribute the default graph plotter checks to decide whether an edge should be curved on the plot or not. If attribute is None, the result will not be stored.
  • default - the default curvature for single edges. Zero means that single edges will be straight. If you want single edges to be curved as well, try passing 0.5 or -0.5 here.
Returns:
the list of curvature values if attribute is None, otherwise None.

read(filename, *args, **kwds)

source code 

Loads a graph from the given filename.

This is just a convenience function, calls Graph.Read directly. All arguments are passed unchanged to Graph.Read

Parameters:
  • filename - the name of the file to be loaded

load(filename, *args, **kwds)

source code 

Loads a graph from the given filename.

This is just a convenience function, calls Graph.Read directly. All arguments are passed unchanged to Graph.Read

Parameters:
  • filename - the name of the file to be loaded

write(graph, filename, *args, **kwds)

source code 

Saves a graph to the given file.

This is just a convenience function, calls Graph.write directly. All arguments are passed unchanged to Graph.write

Parameters:
  • graph - the graph to be saved
  • filename - the name of the file to be written

save(graph, filename, *args, **kwds)

source code 

Saves a graph to the given file.

This is just a convenience function, calls Graph.write directly. All arguments are passed unchanged to Graph.write

Parameters:
  • graph - the graph to be saved
  • filename - the name of the file to be written

summary(obj, stream=None, *args, **kwds)

source code 

Prints a summary of object o to a given stream

Positional and keyword arguments not explicitly mentioned here are passed on to the underlying summary() method of the object if it has any.

Parameters:
  • obj - the object about which a human-readable summary is requested.
  • stream - the stream to be used. If None, the standard output will be used.

   Home       Trees       Indices       Help