API

SignLens

class sign_lens.sign_lens.SignLens(edgelist_fpath, seperator='\t', header=None)[source]

SignLens is a class for analyzing signed networks.

calc_balanced_triangle_dist() tuple[source]

calculate balanced triangle distributions

Returns:
tuple

(balanced triads, unbalanced triads)

calc_edge_num() int[source]

calculate the number of edges

Returns:
int

the edge number

calc_hop_dist() dict[source]

calculate the distrubiton of hops

Returns:
dict

the dict of {'d': counts }

calc_node_num() int[source]

calculate the number of nodes

Returns:
int

the node number

calc_sign_dist() tuple[source]

calculate sign distribution

Returns:
tuple

(positive edge number, negative edge number, pos_neg_ratio)

calc_signed_in_degree() tuple[source]

calculate signed in degree

Returns:
tuple

(G_in_degree, pos_G_in_degree, neg_G_in_dergee)

calc_signed_out_degree() tuple[source]

calculate signed out degree

Returns:
tuple

(G_in_degree, pos_G_in_degree, neg_G_in_dergee)

calc_signed_triads_dist() tuple[source]

calculate signed triads distributions

Returns:
tuple

((+++, ++-, +–, —), balanced triads, unbalanced triads)

calc_singular_value_dist() array[source]

calculated singular value distribution

Returns:
return the svd results of undirected unsigned matrice
report_signed_metrics(output_dir='output') str[source]

Report signed metrics for a signed network.

The main signed network metrics include sign distribution, balanced triangle distrubition, signed in-degree distribution, signed out-degree distribution, in-degree distribution, out-degree distribution, hop plot and singular value distribution according to this paper: “BalanSiNG: Fast and Scalable Generation of Realistic Signed Networks”.

Parameters:
output_dirstr, optional

It will output some figures to the ourput_dir, by default ‘output’

Returns:
str

The table for signed metrics.

SignedTriadFeaExtra

class sign_lens.utils.SignedTriadFeaExtra(edgelist_fpath, undirected=False, seperator='\t')[source]
extract_triad_counts(u, v) tuple[source]
\[A \times B \alpha\]