Пример:
Код: Выделить всё
class CylceRemover:
"""
This class implements a greedy heuristic algorithm described in the following paper:
@inproceedings{Sun:2017:BCN:3091478.3091495,
author = {Sun, Jiankai and Ajwani, Deepak and Nicholson, Patrick K. and Sala, Alessandra and Parthasarathy, Srinivasan},
title = {Breaking Cycles In Noisy Hierarchies},
booktitle = {Proceedings of the 2017 ACM on Web Science Conference},
series = {WebSci '17},
year = {2017},
isbn = {978-1-4503-4896-6},
location = {Troy, New York, USA},
pages = {151--160},
numpages = {10},
url = {http://doi.acm.org/10.1145/3091478.3091495},
doi = {10.1145/3091478.3091495},
acmid = {3091495},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {cycle edges, directed acyclic graph, graph hierarchy, social agony, trueskill},
}
...
"""
def __init__(self, G: nx.DiGraph) -> None:
....
Подробнее здесь: https://stackoverflow.com/questions/783 ... r-function