Spaces:
Sleeping
Sleeping
File size: 968 Bytes
91eaff6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Experiment with deserializing a node-link graph,
then transform it into a _graph of relations_
"""
import pathlib
import typing
from icecream import ic # pylint: disable=E0401
import matplotlib.pyplot as plt # pylint: disable=E0401
import pandas as pd # pylint: disable=E0401
import textgraphs
if __name__ == "__main__":
graph: textgraphs.GraphOfRelations = textgraphs.GraphOfRelations(
textgraphs.SimpleGraph()
)
graph.load_ingram(
pathlib.Path("examples/ingram.json"),
debug = False, # True
)
graph.seeds(
debug = True, # False
)
graph.trace_source_graph()
graph.construct_gor(
debug = True, # False
)
_scores: typing.Dict[ tuple, float ] = graph.get_affinity_scores(
debug = True, # False
)
df: pd.DataFrame = graph.trace_metrics(_scores)
ic(df)
graph.render_gor_plt(_scores)
plt.show()
|