Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 6 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.9%) to scientific vocabulary
Keywords
Repository
Bipartite-network link prediction in Python
Basic Info
- Host: GitHub
- Owner: bi-graph
- License: other
- Language: Python
- Default Branch: master
- Homepage: https://bigraph.readthedocs.io/en/latest/index.html
- Size: 6.12 MB
Statistics
- Stars: 84
- Watchers: 2
- Forks: 21
- Open Issues: 6
- Releases: 0
Topics
Metadata Files
README.md
BiGraph
BiGraph is a Python package for Link prediction in bipartite networks.
- Bug reports: https://github.com/bi-graph/bigraph/issues
Node based similarities and Katz has been implemented. you can find algorithms in bigraph module. Algorithms implemented so far:
| Number | Algorithm |
| 1 | jaccard |
| 2 | adamic adar |
| 3 | common neighbors |
| 4 | preferential attachment |
| 5 | katz similarity |
Installation
Install the latest version of BiGraph:
$ pip install bigraph
Documentation
Simple example
Predicting new links in a randomly generated graph using
Adamic-Adar algorithm:
```python from bigraph.predict import aapredict from bigraph.preprocessing import importfiles, make_graph
def adamicadarprediction(): """ Link prediction on bipartite networks :return: A dictionary containing predicted links """
df, df_nodes = import_files()
print(df)
print(f"Graph Nodes: ", df_nodes)
G = make_graph(df)
print(G)
predicted = aa_predict(G) # Here we have called Adamic Adar method from bigraph module
return predicted
Executing the function
if name == 'main': adamicadarprediction() ```
Evaluating Adamic-Adar algorithm.
You can try other provided prediction algorithms by replacing the "aa" argument.
```python from bigraph.evaluation.evaluation import evaluate from bigraph.preprocessing import importfiles, makegraph
def adamicadarevaluation(): """ Evaluate Adamic-Adar algorithm using 10-Fold cross-validation :return: A dictionary containing the evaluation results """ df, dfnodes = importfiles() G = make_graph(df) results = evaluate(G, k=10, method='aa') # Here we have evaluated adamic-adar # methods using evaluation module. Methods are 'jc', 'aa', 'pa', 'cn' return results
Executing the function
if name == 'main': adamicadarevaluation() ```
Call for Contributions
The Bigraph project welcomes your expertise and enthusiasm!
Ways to contribute to Bigraph:
- Writing code
- Review pull requests
- Develop tutorials, presentations, and other educational materials
- Translate documentation and readme contents
Issues
If you happened to encounter any issue in the codes, please report it here. A better way is to fork the repository on Github and/or create a pull request.
Metrics
Metrics that are calculated during evaluation:
| Number | Evaluattion metrics |
| 1 | Precision |
| 2 | AUC |
| 3 | ROC |
| 4 | returns fpr* |
| 5 | returns tpr* |
- For further usages and calculating different metrics
Dataset format
Your dataset should be in the following format (Exclude the 'Row' column):
| Row | left_side | right_side | Weight* |
| 1 | u0 |
v1 |
1 |
| 2 | u2 |
v1 |
1 |
| 3 | u1 |
v2 |
1 |
| 4 | u3 |
v3 |
1 |
| 5 | u4 |
v3 |
2 |
- Note that running
will create a sample graph for you and will place it in thefrom bigraph.preprocessing import importfiles df, dfnodes = import_files()inputsdirectory.- Although the weight has not been involved in current version, but, the format will be the same.
More examples
Predicting new links in a randomly generated graph using following algorithms:
Preferential attachmentJaccard similarityCommon neighbours
```python from bigraph.predict import papredict, jcpredict, cnpredict from bigraph.preprocessing import importfiles, make_graph
def main(): """ Link prediction on bipartite networks :return: """ df, dfnodes = importfiles() G = makegraph(df) papredict(G) # Preferential attachment jcpredict(G) # Jaccard coefficient cnpredict(G) # Common neighbors
Executing the function
if name == 'main': main() ```
References
| Number | Reference | Year |
| 1 | Yang, Y., Lichtenwalter, R.N. & Chawla, N.V. Evaluating link prediction methods. Knowl Inf Syst 45, 751–782 (2015). https://doi.org/10.1007/s10115-014-0789-0 |
2015 |
| 2 | Liben-nowell, David & Kleinberg, Jon. (2003). The Link Prediction Problem for Social Networks. Journal of the American Society for Information Science and Technology.https://doi.org/58.10.1002/asi.20591 |
2003 |
| 2 | ... |
... |
Future work
- [x] Modulate the functions
- [ ] Add more algorithms
- [ ] Run on CUDA cores
- [ ] Make it faster using vectorization etc.
- [ ] Add more preprocessors
- [ ] Add dataset, graph, and dataframe manipulations
- [ ] Unify and reconstruct the architecture and eliminate redundancy
Notes
-
It can export the graph in .json and .gexf format for further usages. For instance: Gephi etc.
If you found it helpful, please give us a :star:
License
Released under the BSD license
Owner
- Name: BiGraph
- Login: bi-graph
- Kind: organization
- Repositories: 2
- Profile: https://github.com/bi-graph
Graph analysis libraries
GitHub Events
Total
- Watch event: 4
Last Year
- Watch event: 4
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Soran | s****s@g****m | 312 |
| Soran Qadri | k****d@g****m | 29 |
| sigma1326 | t****h@g****m | 8 |
| The Codacy Badger | b****r@c****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 2 years ago
All Time
- Total issues: 7
- Total pull requests: 6
- Average time to close issues: about 3 hours
- Average time to close pull requests: about 5 hours
- Total issue authors: 3
- Total pull request authors: 3
- Average comments per issue: 0.29
- Average comments per pull request: 0.5
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- soran-ghaderi (5)
- erlebach (1)
- stonemasonSantiago (1)
Pull Request Authors
- dependabot[bot] (3)
- sigma1326 (2)
- codacy-badger (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 41 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 2
pypi.org: bigraph
Python package for link prediction in bipartite graphs and networks
- Homepage: https://github.com/bi-graph/bigraph
- Documentation: https://bigraph.readthedocs.io/
- License: BSD License
-
Latest release: 0.1rc7
published about 5 years ago
Rankings
Maintainers (2)
Dependencies
- Pygments ^2.12.0
- matplotlib ^3.5.2
- networkx ^2.6.3
- numpy ^1.22.4
- pandas ^1.4.1
- python >=3.10,<3.11
- scikit-learn ^1.1.1
- scipy ^1.8.1
- tabulate ^0.8.9
- matplotlib >=3.2.0
- networkx >=2.4
- numpy >=1.17.4
- pandas >=0.25.2
- scikit-learn >=0.24.2
- setuptools *
- tabulate >=0.8.7
- setuptools * development
- bluepy *