API Reference
compute(A, raw=False)
Compute the counts fo the Fast Graphlet Transform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
A
|
Union[Graph, csc_matrix]
|
Either the graph as a |
required |
raw
|
bool
|
If True, return both the raw and the net counts of the graphlets. If False, then return only the normalized counts. Defaults to False. |
False
|
Accepts either an undirected, unweighted NetworkX graph or a CSC sparse matrix. If a NetworkX graph is provided, converts it to a CSC adjacency matrix. If a CSC matrix is provided, verifies that it is unweighted and symmetric.
Returns:
Name | Type | Description |
---|---|---|
F |
DataFrame
|
A dataframe with the net counts of the graphlets. |
F_raw |
DataFrame
|
A dataframe with the raw counts of the graphlets (if raw=True). |
Source code in pyfglt/fglt.py
compute_gdd_agreement(df_g1, df_g2, bins=None)
Compute Graphlet Degree Distribution (GDD) agreement between two graphs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df_g1
|
DataFrame
|
Orbit counts for Graph 1 (rows=vertices, columns=orbits). |
required |
df_g2
|
DataFrame
|
Orbit counts for Graph 2 (rows=vertices, columns=orbits). |
required |
bins
|
Union[int, sequence]
|
Bins for histogram. If None, will try an automatic approach. |
None
|
Returns:
Name | Type | Description |
---|---|---|
s |
float
|
The GDD agreement in [0, 1]. |
Source code in pyfglt/fglt.py
compute_graphlet_correlation_matrix(df_g, method='spearman')
Compute the Graphlet Correlation Matrix (GCM) for a single graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df_g
|
DataFrame
|
Orbit counts for a graph (rows=vertices, columns=orbits). |
required |
Returns:
Name | Type | Description |
---|---|---|
C |
DataFrame
|
Correlation matrix of shape (n_orbits, n_orbits). |
Source code in pyfglt/fglt.py
compute_rgf_distance(df_g1, df_g2)
Relative Graphlet Frequency (RGF)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df_g1
|
DataFrame
|
Orbit counts for Graph 1 (rows=vertices, columns=orbits). |
required |
df_g2
|
DataFrame
|
Orbit counts for Graph 2 (rows=vertices, columns=orbits). |
required |
Compute the Relative Graphlet Frequency (RGF) distance between two graphs represented by DataFrames of orbit counts.
Returns:
Name | Type | Description |
---|---|---|
d |
float
|
The RGF distance between the two graphs. |
Source code in pyfglt/fglt.py
gcm_distance(gcm1, gcm2)
Compute a simple distance between two correlation matrices. For instance, the sum of absolute differences (L1 distance).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gcm1
|
DataFrame
|
GCM of the first graph |
required |
gcm2
|
DataFrame
|
GCM of the second graph |
required |
Returns:
Name | Type | Description |
---|---|---|
d |
float
|
A distance measure between the two GCMs. |