bigraph package

Subpackages

Submodules

bigraph.algorithms module

class bigraph.algorithms.Algorithms

Bases: object

static adamic_adar(set_one: list, set_two: list, graph) float

Calculate Adamic Adar score for input lists

Parameters
  • set_one – A list of graph nodes -> part one

  • set_two – A list of graph nodes -> part two

  • graph – NetworkX bipartite graph

Returns

Adamic Adar score

static common_neighbors(set_one: list, set_two: list) int

Calculate Common neighbors score for input lists

Parameters
  • set_one – A list of graph nodes -> part one

  • set_two – A list of graph nodes -> part two

Returns

Common neighbours score

static jaccard(set_one: list, set_two: list) float

Calculate Jaccard score for input lists

Parameters
  • set_one – A list of graph nodes -> part one

  • set_two – A list of graph nodes -> part two

Returns

Jaccard score

static katz_similarity(node_i: int, node_j: int, graph) float

Calculate Katz score for input nodes

Parameters
  • node_i – Starting node

  • node_j – Destination node

  • graph – NetworkX bipartite graph

Returns

Katz similarity score

static preferential_attachment(set_one: list, set_two: list) int

Calculate Preferential attachment score for input lists

Parameters
  • set_one – A list of graph nodes -> part one

  • set_two – A list of graph nodes -> part two

Returns

Preferential attachment score

bigraph.bigraph module

class bigraph.bigraph.BiGraph

Bases: bigraph.algorithms.Algorithms, bigraph.preprocessing.import_files.ImportFiles, bigraph.preprocessing.make_graph.MakeGraph, bigraph.preprocessing.get_adjacents.GetAdjacents

aa_predict() dict

Compute the Jaccard-Needham dissimilarity between two 1-D arrays.

Returns

A dictionary containing the Adamic-adar score for left_element and right_element.

cn_predict() dict

Return the common neighbors of two nodes in a graph.

Returns

A dictionary containing the Common neighbours score for left_element and right_element.

jc_predict() dict

Compute the Jaccard-Needham dissimilarity between two 1-D arrays.

Returns

A dictionary containing the Jaccard distance between vectors left_element and right_element.

katz_predict(df_nodes: dict) dict

Compute the Katz similarity score of all node pairs.

Parameters

df_nodes – Graph nodes

Returns

A dictionary containing the Preferential attachment score for left_element and right_element.

pa_predict() dict

Compute the preferential attachment score of all node pairs.

Returns

A dictionary containing the Preferential attachment score for left_element and right_element.

Module contents

A package for link prediction in bipartite networks.

class bigraph.BiGraph

Bases: bigraph.algorithms.Algorithms, bigraph.preprocessing.import_files.ImportFiles, bigraph.preprocessing.make_graph.MakeGraph, bigraph.preprocessing.get_adjacents.GetAdjacents

aa_predict() dict

Compute the Jaccard-Needham dissimilarity between two 1-D arrays.

Returns

A dictionary containing the Adamic-adar score for left_element and right_element.

cn_predict() dict

Return the common neighbors of two nodes in a graph.

Returns

A dictionary containing the Common neighbours score for left_element and right_element.

jc_predict() dict

Compute the Jaccard-Needham dissimilarity between two 1-D arrays.

Returns

A dictionary containing the Jaccard distance between vectors left_element and right_element.

katz_predict(df_nodes: dict) dict

Compute the Katz similarity score of all node pairs.

Parameters

df_nodes – Graph nodes

Returns

A dictionary containing the Preferential attachment score for left_element and right_element.

pa_predict() dict

Compute the preferential attachment score of all node pairs.

Returns

A dictionary containing the Preferential attachment score for left_element and right_element.