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.

Supported values for preset:

  • complete

  • minimal

  • default

Parameters:

preset (str, optional) – Preset to be used for generating the config values. Default: “default”

getMeasure(id)

Return state of given measure option

Supported values for id:

  • Centrality.Degree

  • Centrality.CoreDecomposition

  • Centrality.ClusteringCoefficient

  • Centrality.PageRank

  • Centrality.KPath

  • Centrality.Katz

  • Centrality.Betweenness

  • Centrality.Closeness

  • Partition.Communities

  • Partition.ConnectedComponents

  • Partition.CoreDecomposition

Returns:

State of measure id.

Return type:

bool

getMeasureCorrelation(id)

Return state of given correlation (measure) option

Supported values for id:

  • Pearson

  • Spearman

  • Fechner

Returns:

State of measure correlation id.

Return type:

bool

getProperty(id)

return state of given property option

Supported values for id:

  • Diameter

  • EffectiveDiameter

Returns:

State of property id.

Return type:

bool

setMeasure(id, enabled=True)

Enable/disable given measure option.

Supported values for id:

  • Centrality.Degree

  • Centrality.CoreDecomposition

  • Centrality.ClusteringCoefficient

  • Centrality.PageRank

  • Centrality.KPath

  • Centrality.Katz

  • Centrality.Betweenness

  • Centrality.Closeness

  • Partition.Communities

  • Partition.ConnectedComponents

  • Partition.CoreDecomposition

Parameters:
  • id (str) – Measure value to set.

  • enabled (bool, optional) – Indicates whether measure id should be enabled or not. Default: True

setMeasureCorrelation(id, enabled=True)

Enable/disable given measure correlation option.

Supported values for id:

  • Pearson

  • Spearman

  • Fechner

Parameters:
  • id (str) – Measure correlation value to set.

  • enabled (bool, optional) – Indicates whether measure correlation id should be enabled or not. Default: True

setProperty(id, enabled=True)

Enable/disable given property option.

Supported values for id:

  • Diameter

  • EffectiveDiameter

Parameters:
  • id (str) – Property value to set.

  • enabled (bool, optional) – Indicates whether property id should be enabled or not. Default: True

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

Bases: object

Automated network profiling class. Don’t call the constructor directly. Use networkit.profile.profile.Profile.create to instantiate a profile.

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

Creates a profile object

Parameters:
  • G (networkit.Graph) – Graph to profile.

  • preset (str) – Name of preset configuration: “complete”, “minimal”, “default”

  • Config (networkit.profile.profile.Config) – Config object to control some aspects of the generation behaviour. Default: None

Returns:

Resulting profiling object.

Return type:

networkit.profile.profile.Profile

getCategory(measure)

Returns the category of an given measure.

Supported values for measure:

  • Centrality.Degree

  • Centrality.CoreDecomposition

  • Centrality.ClusteringCoefficient

  • Centrality.PageRank

  • Centrality.KPath

  • Centrality.Katz

  • Centrality.Betweenness

  • Centrality.Closeness

  • Partition.Communities

  • Partition.ConnectedComponents

  • Partition.CoreDecomposition

Parameters:

measure (str) – Measure name.

Returns:

Category of measure.

Return type:

str

getElapsedTime(measure)

Returns the elapsed computation times of an given measure.

Supported values for measure:

  • Centrality.Degree

  • Centrality.CoreDecomposition

  • Centrality.ClusteringCoefficient

  • Centrality.PageRank

  • Centrality.KPath

  • Centrality.Katz

  • Centrality.Betweenness

  • Centrality.Closeness

  • Partition.Communities

  • Partition.ConnectedComponents

  • Partition.CoreDecomposition

Parameters:

measure (str) – Measure name.

Returns:

Elapsed time for computing measure.

Return type:

float

classmethod getParallel()

Returns the number of parallel threads/processes to use

Returns:

Number of threads to use for algorithms used during profiling.

Return type:

int

getStat(measure)

Returns an directory of all computed measure values.

Supported values for measure:

  • Centrality.Degree

  • Centrality.CoreDecomposition

  • Centrality.ClusteringCoefficient

  • Centrality.PageRank

  • Centrality.KPath

  • Centrality.Katz

  • Centrality.Betweenness

  • Centrality.Closeness

  • Partition.Communities

  • Partition.ConnectedComponents

  • Partition.CoreDecomposition

Parameters:

measure (str) – Measure name.

Returns:

Dictionary with computed measure values.

Return type:

dict(float)

classmethod getVerbose()

Returns verbose settings.

Returns:

Tuple with three entries -> (verbose, verboseLevel, filename).

Return type:

tuple(bool, int, str)

output(outputType, directory, filename='graph', style='light', color=colors['green'], parallel=False)

Outputs a computed profile to disk.

Parameters:
  • outputType (str) – Profile output format (“HTML”, “LaTeX”).

  • directory (str) – Directory to write.

  • filename (str, optional) – Enable/disable additional logfile support to given file. Default: “”

  • style (str, optional) – Style of generated output. Default: “light”

  • color (tuple(float, float, float), optional) – Mainly used color of given style. Given in RGB values between 0.0 and 1.0. Default: “green” -> (0.003, 0.474, 0.435)

  • parallel (bool, optional) – Run some additional parts of the generation in parallel (experimental). Default: False

classmethod setParallel(parallel)

Set the number of parallel threads/processes to use.

Parameters:

parallel (int) – Number of threads to use for algorithms used during profiling.

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

Set verbose behaviour of all public methods.

Parameters:
  • verbose (bool, optional)

  • Default (Enable/disable display verbose.)

  • level (int, optional) – Set level of verbose (0, 1). Default: False

  • filename (str, optional) – Enable/disable additional logfile support to given file. Default: “”

show(style='light', color=colors['green'], parallel=False)

Display computed profile.

Parameters:
  • style (str, optional) – Style of generated output. Default: “light”

  • color (tuple(float, float, float), optional) – Mainly used color of given style. Given in RGB values between 0.0 and 1.0. Default: “green” -> (0.003, 0.474, 0.435)

  • parallel (bool, optional) – Run some additional parts of the generation in parallel (experimental). Default: False

classmethod verbosePrint(text='', end='\n', level=0)

Print for verbose output.

Parameters:
  • text (str, optional) – Text to add to the verbose print. Default: “”

  • end (str, optional) – Marker for line break. Default: “n”

  • level (int, optional) – Level for verbose printing. Default: 0

networkit.profiling.profiling.getfilepath(filename)

Helper function the get complete filepath based on filename. Only used by profiler - no need to be called independently.

Parameters:

filename (str) – Name of file.

networkit.profiling.profiling.readfile(filename, removeWS=False)

Helper function for file-loading. Only used by profiler - no need to be called independently.

Parameters:
  • filename (str) – Name of file.

  • removeWS (bool, optional) – Indicates whether whitespace should be removed. Default: False

networkit.profiling.profiling.walk(inputDir, outputDir, graphFormat, filePattern='`*`', preset='default', config=None, outputType='HTML', style='light', color=colors['green'], recursive=False, parallel=False)

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

Parameters:
  • inputDir (str) – The directory to search.

  • outputDir (str) – Directory to write the generated profiles.

  • graphFormat (networkit.graphio.Format) – Format of input graphs.

  • filePattern (str, optional) – Specify accepted file names, e.g.: *.METIS.graph. Default: *

  • preset (str, optional) – Config preset (“minimal”, “default”, “full”). Default: “default”

  • Config (networkit.profile.profile.Config) – Config object to control some aspects of the generation behaviour. Default: None

  • outputType (str, optional) – Profile output format (“HTML”, “LaTeX”). Default: “HTML”

  • style (str, optional) – Style of generated output. Default: “light”

  • color (tuple(float, float, float), optional) – Mainly used color of given style. Given in RGB values between 0.0 and 1.0. Default: “green” -> (0.003, 0.474, 0.435)

  • recursive (bool, optional) – Also search in subfolders for matching files. Default: False

  • parallel (bool, optional) – Run some additional parts of the generation in parallel (experimental). Default: False