Scoring

The scoring submodule contains a collection of scoring function to describe graphs. The scoring function are used to compare graphs.

The scoring function are defined in the scoring module.

  • scoring.default_scores: contains all available scores in a dictionary {name: score}.

  • scoring.size: contains additional scores describing the size of the graphs (number of nodes, number of edges)

  • scoring.score_names: contains a dictionary to convert plain score names to short latex names.

The function scoring.get_default_scores() return the default_scores in a convenient way, see below

Example of code on a single graph:

import structify_net.scoring
g=nx.karate_club_graph()
score=scoring.hierarchy(g)
scores = scoring.compute_all_scores(g)

Example of code on a graph model:

import structify_net.scoring
model=zoo.sort_nestedness(nodes=100)
model.scores(m=1000)
model.scores(m=1000,scores={"coreness":scoring.coreness},epsilons=[0,0.1,0.2],runs=3,)

Individual scoring functions

scoring.has_giant_component(graph[, threshold])

Check if the graph has a giant component

scoring.giant_component_ratio(graph)

Ratio of the largest component to the total number of nodes

scoring.transitivity(graph)

Transitivity of the graph

scoring.average_clustering(graph)

Average clustering coefficient of the graph

scoring.average_shortest_path_length(graph)

The average shortest path length of the graph

scoring.modularity(graph[, normalized])

Returns the modularity of the graph

scoring.degree_heterogeneity(graph)

Compute the degree heterogeneity of the graph

scoring.is_degree_heterogeneous(graph)

Returns True if the graph is degree heterogeneous, False otherwise

scoring.robustness(graph)

Robustness of the graph

scoring.degree_assortativity(graph[, ...])

Degree assortativity coefficient of the graph

scoring.hierarchy(graph[, normalized, ...])

Hierarchy of the graph

scoring.boundaries(graph[, normalized])

Boundaries of the graph

scoring.coreness(graph[, normalized])

Coreness of the graph

Useful functions

scoring.compute_all_scores(graph)

Compute all scores for a graph

scoring.scores_for_graphs(graphs[, scores, ...])

Compute scores for a list of graphs

scoring.scores_for_generators(generators[, ...])

Scores for a list of generators

scoring.scores_for_rank_models(rank_models, m)

Scores for a list of rank models

scoring.scores_for_rank_functions(...[, ...])

Scores for a list of rank functions

scoring.compare_graphs(df_reference, df_graphs)

Compares a list of graphs to a reference graph

scoring.get_default_scores([with_size, ...])

Returns the default scores