networkit.profiling

class networkit.profiling.profiling.Config

Bases: object

object to control profiling.Profile behaviour

classmethod createConfig(preset='default')

create a config object by selection a named preset of predefined options (complete/minimal/default)

getMeasure(id)

return state of given measure option

getMeasureCorrelation(id)

return state of given correlation (measure) option

getProperty(id)

return state of given property option

setMeasure(id, enabled=True)

enable/disable given measure option

setMeasureCorrelation(id, enabled=True)

enable/disable given correlation (measure) option

setProperty(id, enabled=True)

enable/disable given property option

class networkit.profiling.profiling.DisplayObject(data=None, url=None, filename=None)

Bases: object

An object that wraps data to be displayed.

reload()

Reload the raw data from file or URL.

class networkit.profiling.profiling.HTML(data=None, url=None, filename=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Image(data=None, url=None, filename=None, format='png', embed=None, width=None, height=None, retina=False, unconfined=False, metadata=None)

Bases: IPython.core.display.DisplayObject

reload()

Reload the raw data from file or URL.

class networkit.profiling.profiling.JSON(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

JSON expects a JSON-able dict or list

not an already-serialized JSON string.

Scalar types (None, number, string) are not allowed, only dict or list containers.

data
class networkit.profiling.profiling.Javascript(data=None, url=None, filename=None, lib=None, css=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Latex(data=None, url=None, filename=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Markdown(data=None, url=None, filename=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Math(data=None, url=None, filename=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Pretty(data=None, url=None, filename=None)

Bases: IPython.core.display.TextDisplayObject

class networkit.profiling.profiling.Profile(G, token=<object object>)

Bases: object

Automated network profiling class.

Call Profile.create to instantiate a profile.

classmethod create(G, preset='default', config=None)

creates a profile object

Args:
G: graph to profile preset: name of preset configuration: “complete”, “minimal”, “default” config: object to control some aspects of the generation behaviour (Config)
Returns:
profile object
getCategory(measure)

returns the category of an given measure

getElapsedTime(measure)

returns the elapsed computation times of an given measure

classmethod getParallel()

returns the number of parallel threads/processes to use

getStat(measure)

returns an directory of all computed measure values

classmethod getVerbose()

returns verbose settings

output(outputType, directory, style='light', color=(0.003, 0.474, 0.435), parallel=False)

outputs a computed profile to disk

Args:
outputType: profile output format (“HTML”, “LaTeX”) directory: directory to write style: style of generated output (“light”) color: mainly used color of given style arallel: run some additional parts of the generation in parallel (experimental)
classmethod setParallel(parallel)

set the number of parallel threads/processes to use

classmethod setVerbose(verbose=False, level=0, filename='')

set verbose behaviour of all public methods

Args:
verbose: enable/disable display verbose level: set level of verbose (0, 1) filename: enable/disable additional logfile support to given file
show(style='light', color=(0.003, 0.474, 0.435), parallel=False)

display computed profile

Args:
style: style of generated output (“light”) color: mainly used color of given style (RGB values in [0,1]) parallel: run some additional parts of the generation in parallel (experimental)
classmethod verbosePrint(text='', end='\n', level=0)

print for verbose output

class networkit.profiling.profiling.SVG(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

data
class networkit.profiling.profiling.TextDisplayObject(data=None, url=None, filename=None)

Bases: IPython.core.display.DisplayObject

Validate that display data is text

networkit.profiling.profiling.clear_output(wait=False)

Clear the output of the current cell receiving output.

wait : bool [default: false]
Wait to clear the output until new output is available to replace it.
networkit.profiling.profiling.display(*objs, **kwargs)

Display a Python object in all frontends.

By default all representations will be computed and sent to the frontends. Frontends can decide which representation is used and how.

objs : tuple of objects
The Python objects to display.
raw : bool, optional
Are the objects to be displayed already mimetype-keyed dicts of raw display data, or Python objects that need to be formatted before display? [default: False]
include : list or tuple, optional
A list of format type strings (MIME types) to include in the format data dict. If this is set only the format types included in this list will be computed.
exclude : list or tuple, optional
A list of format type strings (MIME types) to exclude in the format data dict. If this is set all format types will be computed, except for those included in this argument.
metadata : dict, optional
A dictionary of metadata to associate with the output. mime-type keys in this dictionary will be associated with the individual representation formats, if they exist.
networkit.profiling.profiling.display_html(*objs, **kwargs)

Display the HTML representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw HTML data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_javascript(*objs, **kwargs)

Display the Javascript representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw javascript data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_jpeg(*objs, **kwargs)

Display the JPEG representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw JPEG data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_json(*objs, **kwargs)

Display the JSON representation of an object.

Note that not many frontends support displaying JSON.

objs : tuple of objects
The Python objects to display, or if raw=True raw json data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_latex(*objs, **kwargs)

Display the LaTeX representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw latex data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_markdown(*objs, **kwargs)

Displays the Markdown representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw markdown data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_pdf(*objs, **kwargs)

Display the PDF representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw javascript data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_png(*objs, **kwargs)

Display the PNG representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw png data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_pretty(*objs, **kwargs)

Display the pretty (default) representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw text data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.display_svg(*objs, **kwargs)

Display the SVG representation of an object.

objs : tuple of objects
The Python objects to display, or if raw=True raw svg data to display.
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
metadata : dict (optional)
Metadata to be associated with the specific mimetype output.
networkit.profiling.profiling.getfilepath(filename)
networkit.profiling.profiling.publish_display_data(data, metadata=None, source=None)

Publish data and metadata to all frontends.

See the display_data message in the messaging documentation for more details about this message type.

The following MIME types are currently implemented:

  • text/plain
  • text/html
  • text/markdown
  • text/latex
  • application/json
  • application/javascript
  • image/png
  • image/jpeg
  • image/svg+xml
data : dict
A dictionary having keys that are valid MIME types (like ‘text/plain’ or ‘image/svg+xml’) and values that are the data for that MIME type. The data itself must be a JSON’able data structure. Minimally all data should have the ‘text/plain’ data, which can be displayed by all frontends. If more than the plain text is given, it is up to the frontend to decide which representation to use.
metadata : dict
A dictionary for metadata related to the data. This can contain arbitrary key, value pairs that frontends can use to interpret the data. mime-type keys matching those in data can be used to specify metadata about particular representations.
source : str, deprecated
Unused.
networkit.profiling.profiling.readfile(filename, removeWS=False)

private helper function for file-loading

networkit.profiling.profiling.set_matplotlib_close(close=True)

Set whether the inline backend closes all figures automatically or not.

By default, the inline backend used in the IPython Notebook will close all matplotlib figures automatically after each cell is run. This means that plots in different cells won’t interfere. Sometimes, you may want to make a plot in one cell and then refine it in later cells. This can be accomplished by:

In [1]: set_matplotlib_close(False)

To set this in your config files use the following:

c.InlineBackend.close_figures = False
close : bool
Should all matplotlib figures be automatically closed after each cell is run?
networkit.profiling.profiling.set_matplotlib_formats(*formats, **kwargs)

Select figure formats for the inline backend. Optionally pass quality for JPEG.

For example, this enables PNG and JPEG output with a JPEG quality of 90%:

In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)

To set this in your config files use the following:

c.InlineBackend.figure_formats = {'png', 'jpeg'}
c.InlineBackend.print_figure_kwargs.update({'quality' : 90})
*formats : strs
One or more figure formats to enable: ‘png’, ‘retina’, ‘jpeg’, ‘svg’, ‘pdf’.
**kwargs :
Keyword args will be relayed to figure.canvas.print_figure.
networkit.profiling.profiling.walk(inputDir, outputDir, graphFormat, filePattern='*', preset='default', config=None, outputType='HTML', style='light', color=(0.003, 0.474, 0.435), recursive=False, parallel=False)

tests all files of a directory for the given conditions and generates a profile when matching

Args:
inputDir: the directory to search filePattern: specify accepted file names, e.g.: *.METIS.graph outputDir: directory to write the generated profiles preset: config preset (“minimal”, “default”, “full”) config: object for fine-grained control over profile content (Config) – overrides preset outputType: profile output format (“HTML”, “LaTeX”) style: style of generated output (“light”) color: mainly used color of given style (RGB values in [0,1]) recursive: also search in subfolders for matching files parallel: run some additional parts of the generation in parallel (experimental) graphFormat: format of matching files (e.g.: Format.METIS)